diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000000..70925a7e3aa --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +open_collective: typescript-eslint diff --git a/.prettierignore b/.prettierignore index 2b05b38a1ee..1dd0c399667 100644 --- a/.prettierignore +++ b/.prettierignore @@ -8,3 +8,6 @@ packages/eslint-plugin-tslint/tests/test-tslint-rules-directory/alwaysFailRule.js .github packages/eslint-plugin/src/configs/*.json + +# Ignore CHANGELOG.md files to avoid issues with automated release job +CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md index bb494eb4c46..36abcf4782d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,29 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) + + +### Bug Fixes + +* **eslint-plugin:** [no-magic-numbers] add support for enums ([#543](https://github.com/typescript-eslint/typescript-eslint/issues/543)) ([5c40d01](https://github.com/typescript-eslint/typescript-eslint/commit/5c40d01)) +* **eslint-plugin:** [promise-function-async] allow any as return value ([#553](https://github.com/typescript-eslint/typescript-eslint/issues/553)) ([9a387b0](https://github.com/typescript-eslint/typescript-eslint/commit/9a387b0)) +* **eslint-plugin:** Remove duplicated code ([#611](https://github.com/typescript-eslint/typescript-eslint/issues/611)) ([c4df4ff](https://github.com/typescript-eslint/typescript-eslint/commit/c4df4ff)) +* **parser:** add simpleTraverse, replaces private ESLint util ([#628](https://github.com/typescript-eslint/typescript-eslint/issues/628)) ([aa206c4](https://github.com/typescript-eslint/typescript-eslint/commit/aa206c4)) +* **typescript-estree:** fix more cases with double slash in JSX text ([#607](https://github.com/typescript-eslint/typescript-eslint/issues/607)) ([34cfa53](https://github.com/typescript-eslint/typescript-eslint/commit/34cfa53)) + + +### Features + +* **eslint-plugin:** [no-explicit-any] ignoreRestArgs ([#548](https://github.com/typescript-eslint/typescript-eslint/issues/548)) ([753ad75](https://github.com/typescript-eslint/typescript-eslint/commit/753ad75)) +* **eslint-plugin:** add `consistent-type-definitions` rule ([#463](https://github.com/typescript-eslint/typescript-eslint/issues/463)) ([ec87d06](https://github.com/typescript-eslint/typescript-eslint/commit/ec87d06)) +* **eslint-plugin:** add new rule no-empty-function ([#626](https://github.com/typescript-eslint/typescript-eslint/issues/626)) ([747bfcb](https://github.com/typescript-eslint/typescript-eslint/commit/747bfcb)) +* **eslint-plugin:** add new rule no-floating-promises ([#495](https://github.com/typescript-eslint/typescript-eslint/issues/495)) ([61e6385](https://github.com/typescript-eslint/typescript-eslint/commit/61e6385)) + + + + + ## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) ### Bug Fixes diff --git a/README.md b/README.md index 69ed23c1070..d8bc576a1ef 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ For example: var x: number = 1; ``` -This is not valid JavaScript code, because it contains a so called type-annotation. When the TypeScript Compiler parses this code to produce a TypeScript AST, that `: number` syntax will be represented in the tree, and this is simply not something that ESLint can understand without additional help. +This is not valid JavaScript code, because it contains a so-called type annotation. When the TypeScript Compiler parses this code to produce a TypeScript AST, that `: number` syntax will be represented in the tree, and this is simply not something that ESLint can understand without additional help. However, we can leverage the fact that ESLint has been designed with these use-cases in mind! diff --git a/lerna.json b/lerna.json index 42c700c4a69..b1a0c8942fb 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.10.2", + "version": "1.11.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 218a52b5e16..26731119b1d 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + ## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index b3db04c9f57..d62e4996099 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "1.10.2", + "version": "1.11.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -31,7 +31,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "1.10.2", + "@typescript-eslint/experimental-utils": "1.11.0", "lodash.memoize": "^4.1.2" }, "peerDependencies": { @@ -41,6 +41,6 @@ "devDependencies": { "@types/json-schema": "^7.0.3", "@types/lodash.memoize": "^4.1.4", - "@typescript-eslint/parser": "1.10.2" + "@typescript-eslint/parser": "1.11.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 3fb3436858e..497ba5cb783 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,26 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) + + +### Bug Fixes + +* **eslint-plugin:** [no-magic-numbers] add support for enums ([#543](https://github.com/typescript-eslint/typescript-eslint/issues/543)) ([5c40d01](https://github.com/typescript-eslint/typescript-eslint/commit/5c40d01)) +* **eslint-plugin:** [promise-function-async] allow any as return value ([#553](https://github.com/typescript-eslint/typescript-eslint/issues/553)) ([9a387b0](https://github.com/typescript-eslint/typescript-eslint/commit/9a387b0)) + + +### Features + +* **eslint-plugin:** [no-explicit-any] ignoreRestArgs ([#548](https://github.com/typescript-eslint/typescript-eslint/issues/548)) ([753ad75](https://github.com/typescript-eslint/typescript-eslint/commit/753ad75)) +* **eslint-plugin:** add `consistent-type-definitions` rule ([#463](https://github.com/typescript-eslint/typescript-eslint/issues/463)) ([ec87d06](https://github.com/typescript-eslint/typescript-eslint/commit/ec87d06)) +* **eslint-plugin:** add new rule no-empty-function ([#626](https://github.com/typescript-eslint/typescript-eslint/issues/626)) ([747bfcb](https://github.com/typescript-eslint/typescript-eslint/commit/747bfcb)) +* **eslint-plugin:** add new rule no-floating-promises ([#495](https://github.com/typescript-eslint/typescript-eslint/issues/495)) ([61e6385](https://github.com/typescript-eslint/typescript-eslint/commit/61e6385)) + + + + + ## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) ### Bug Fixes diff --git a/packages/eslint-plugin/README.md b/packages/eslint-plugin/README.md index fe41169e384..2b578913945 100644 --- a/packages/eslint-plugin/README.md +++ b/packages/eslint-plugin/README.md @@ -131,6 +131,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/ban-types`](./docs/rules/ban-types.md) | Enforces that types will not to be used | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/camelcase`](./docs/rules/camelcase.md) | Enforce camelCase naming convention | :heavy_check_mark: | | | | [`@typescript-eslint/class-name-casing`](./docs/rules/class-name-casing.md) | Require PascalCased class and interface names | :heavy_check_mark: | | | +| [`@typescript-eslint/consistent-type-definitions`](./docs/rules/consistent-type-definitions.md) | Consistent with type definition either `interface` or `type` | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/explicit-function-return-type`](./docs/rules/explicit-function-return-type.md) | Require explicit return types on functions and class methods | :heavy_check_mark: | | | | [`@typescript-eslint/explicit-member-accessibility`](./docs/rules/explicit-member-accessibility.md) | Require explicit accessibility modifiers on class properties and methods | :heavy_check_mark: | | | | [`@typescript-eslint/func-call-spacing`](./docs/rules/func-call-spacing.md) | Require or disallow spacing between function identifiers and their invocations | | :wrench: | | @@ -142,6 +143,7 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/member-ordering`](./docs/rules/member-ordering.md) | Require a consistent member declaration order | | | | | [`@typescript-eslint/no-angle-bracket-type-assertion`](./docs/rules/no-angle-bracket-type-assertion.md) | Enforces the use of `as Type` assertions instead of `` assertions | :heavy_check_mark: | | | | [`@typescript-eslint/no-array-constructor`](./docs/rules/no-array-constructor.md) | Disallow generic `Array` constructors | :heavy_check_mark: | :wrench: | | +| [`@typescript-eslint/no-empty-function`](./docs/rules/no-empty-function.md) | Disallow empty functions | | | | | [`@typescript-eslint/no-empty-interface`](./docs/rules/no-empty-interface.md) | Disallow the declaration of empty interfaces | :heavy_check_mark: | | | | [`@typescript-eslint/no-explicit-any`](./docs/rules/no-explicit-any.md) | Disallow usage of the `any` type | :heavy_check_mark: | | | | [`@typescript-eslint/no-extra-parens`](./docs/rules/no-extra-parens.md) | Disallow unnecessary parentheses | | :wrench: | | @@ -168,7 +170,6 @@ Then you should add `airbnb` (or `airbnb-base`) to your `extends` section of `.e | [`@typescript-eslint/prefer-for-of`](./docs/rules/prefer-for-of.md) | Prefer a ‘for-of’ loop over a standard ‘for’ loop if the index is only used to access the array being iterated | | | | | [`@typescript-eslint/prefer-function-type`](./docs/rules/prefer-function-type.md) | Use function types instead of interfaces with call signatures | | :wrench: | | | [`@typescript-eslint/prefer-includes`](./docs/rules/prefer-includes.md) | Enforce `includes` method over `indexOf` method | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/prefer-interface`](./docs/rules/prefer-interface.md) | Prefer an interface declaration over a type literal (type T = { ... }) | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/prefer-namespace-keyword`](./docs/rules/prefer-namespace-keyword.md) | Require the use of the `namespace` keyword instead of the `module` keyword to declare custom TypeScript modules | :heavy_check_mark: | :wrench: | | | [`@typescript-eslint/prefer-regexp-exec`](./docs/rules/prefer-regexp-exec.md) | Prefer RegExp#exec() over String#match() if no global flag is provided | | | :thought_balloon: | | [`@typescript-eslint/prefer-string-starts-ends-with`](./docs/rules/prefer-string-starts-ends-with.md) | Enforce the use of `String#startsWith` and `String#endsWith` instead of other equivalent methods of checking substrings | | :wrench: | :thought_balloon: | diff --git a/packages/eslint-plugin/ROADMAP.md b/packages/eslint-plugin/ROADMAP.md index fb05df45b91..65c421124f2 100644 --- a/packages/eslint-plugin/ROADMAP.md +++ b/packages/eslint-plugin/ROADMAP.md @@ -14,7 +14,7 @@ | --------------------------------- | :-: | ---------------------------------------------------- | | [`adjacent-overload-signatures`] | ✅ | [`@typescript-eslint/adjacent-overload-signatures`] | | [`ban-ts-ignore`] | ✅ | [`@typescript-eslint/ban-ts-ignore`] | -| [`ban-types`] | ✅ | [`@typescript-eslint/ban-types`] | +| [`ban-types`] | 🌓 | [`@typescript-eslint/ban-types`][1] | | [`member-access`] | ✅ | [`@typescript-eslint/explicit-member-accessibility`] | | [`member-ordering`] | ✅ | [`@typescript-eslint/member-ordering`] | | [`no-any`] | ✅ | [`@typescript-eslint/no-explicit-any`] | @@ -36,6 +36,8 @@ | [`typedef-whitespace`] | ✅ | [`@typescript-eslint/type-annotation-spacing`] | | [`unified-signatures`] | ✅ | [`@typescript-eslint/unified-signatures`] | +[1] The ESLint rule only supports exact string matching, rather than regular expressions
+ ### Functionality | TSLint rule | | ESLint rule | diff --git a/packages/eslint-plugin/docs/rules/consistent-type-definitions.md b/packages/eslint-plugin/docs/rules/consistent-type-definitions.md new file mode 100644 index 00000000000..3e60f2ced7c --- /dev/null +++ b/packages/eslint-plugin/docs/rules/consistent-type-definitions.md @@ -0,0 +1,74 @@ +# Consistent with type definition either `interface` or `type` (consistent-type-definitions) + +There are two ways to define a type. + +```ts +// type alias +type T1 = { + a: string; + b: number; +}; + +// interface keyword +interface T2 { + a: string; + b: number; +} +``` + +## Options + +This rule accepts one string option: + +- `"interface"`: enforce using `interface`s for object type definitions. +- `"type"`: enforce using `type`s for object type definitions. + +For example: + +```CJSON +{ + // Use type for object definitions + "@typescript-eslint/consistent-type-definitions": ["error", "type"] +} +``` + +## Rule Details + +Examples of **incorrect** code with `interface` option. + +```ts +type T = { x: number }; +``` + +Examples of **correct** code with `interface` option. + +```ts +type T = string; +type Foo = string | {}; + +interface T { + x: number; +} +``` + +Examples of **incorrect** code with `type` option. + +```ts +interface T { + x: number; +} +``` + +Examples of **correct** code with `type` option. + +```ts +type T = { x: number }; +``` + +## When Not To Use It + +If you specifically want to use an interface or type literal for stylistic reasons, you can disable this rule. + +## Compatibility + +- TSLint: [interface-over-type-literal](https://palantir.github.io/tslint/rules/interface-over-type-literal/) diff --git a/packages/eslint-plugin/docs/rules/no-empty-function.md b/packages/eslint-plugin/docs/rules/no-empty-function.md new file mode 100644 index 00000000000..e06961d4259 --- /dev/null +++ b/packages/eslint-plugin/docs/rules/no-empty-function.md @@ -0,0 +1,47 @@ +# Disallow Empty Functions (@typescript-eslint/no-empty-function) + +Empty functions can reduce readability because readers need to guess whether it’s intentional or not. So writing a clear comment for empty functions is a good practice. + +## Rule Details + +The `@typescript-eslint/no-empty-function` rule extends the `no-empty-function` rule from ESLint core, and adds support for handling Typescript specific code that would otherwise trigger the rule. + +One example of valid Typescript specific code that would otherwise trigger the `no-empty-function` rule is the use of [parameter properties](https://www.typescriptlang.org/docs/handbook/classes.html#parameter-properties) in constructor functions: + +```typescript +class Person { + constructor(private firstName: string, private surname: string) {} +} +``` + +The above code is functionally equivalent to: + +```typescript +class Person { + private firstName: string; + private surname: string; + + constructor(firstName: string, surname: string) { + this.firstName = firstName; + this.surname = surname; + } +} +``` + +Parameter properties enable both the _declaration_ and _initialization_ of member properties in a single location, avoiding the boilerplate & duplication that is common when initializing member properties from parameter values in a constructor function. + +In these cases, although the constructor has an empty function body, it is technically valid and should not trigger an error. + +See the [ESLint documentation](https://eslint.org/docs/rules/no-empty-function) for more details on the `no-empty-function` rule. + +## Rule Changes + +```cjson +{ + // note you must disable the base rule as it can report incorrect errors + "no-empty-function": "off", + "@typescript-eslint/no-empty-function": "error" +} +``` + +Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-empty-function.md) diff --git a/packages/eslint-plugin/docs/rules/no-explicit-any.md b/packages/eslint-plugin/docs/rules/no-explicit-any.md index 2439f43c2f3..3e3a6391a6f 100644 --- a/packages/eslint-plugin/docs/rules/no-explicit-any.md +++ b/packages/eslint-plugin/docs/rules/no-explicit-any.md @@ -5,7 +5,7 @@ When `any` is used, all compiler type checks around that value are ignored. ## Rule Details -This rule goes doesn't allow `any` types to be defined. +This rule doesn't allow `any` types to be defined. It aims to keep TypeScript maximally useful. TypeScript has a compiler flag for `--noImplicitAny` that will prevent an `any` type from being implied by the compiler, but doesn't prevent @@ -87,6 +87,52 @@ function greet(param: Array): string {} function greet(param: Array): Array {} ``` +### ignoreRestArgs + +A boolean to specify if arrays from the rest operator are considered okay. `false` by default. + +Examples of **incorrect** code for the `{ "ignoreRestArgs": false }` option: + +```ts +/*eslint @typescript-eslint/no-explicit-any: ["error", { "ignoreRestArgs": false }]*/ + +function foo1(...args: any[]): void {} +function foo2(...args: readonly any[]): void {} +function foo3(...args: Array): void {} +function foo4(...args: ReadonlyArray): void {} + +const bar1 = (...args: any[]): void {} +const bar2 = (...args: readonly any[]): void {} +const bar3 = (...args: Array): void {} +const bar4 = (...args: ReadonlyArray): void {} + +const baz1 = function (...args: any[]) {} +const baz2 = function (...args: readonly any[]) {} +const baz3 = function (...args: Array) {} +const baz4 = function (...args: ReadonlyArray) {} +``` + +Examples of **correct** code for the `{ "ignoreRestArgs": true }` option: + +```ts +/*eslint @typescript-eslint/no-explicit-any: ["error", { "ignoreRestArgs": true }]*/ + +function foo1(...args: any[]): void {} +function foo2(...args: readonly any[]): void {} +function foo3(...args: Array): void {} +function foo4(...args: ReadonlyArray): void {} + +const bar1 = (...args: any[]): void {} +const bar2 = (...args: readonly any[]): void {} +const bar3 = (...args: Array): void {} +const bar4 = (...args: ReadonlyArray): void {} + +const baz1 = function (...args: any[]) {} +const baz2 = function (...args: readonly any[]) {} +const baz3 = function (...args: Array) {} +const baz4 = function (...args: ReadonlyArray) {} +``` + ## When Not To Use It If an unknown type or a library without typings is used diff --git a/packages/eslint-plugin/docs/rules/no-magic-numbers.md b/packages/eslint-plugin/docs/rules/no-magic-numbers.md index 2ff5aab519d..b5a1e92fd09 100644 --- a/packages/eslint-plugin/docs/rules/no-magic-numbers.md +++ b/packages/eslint-plugin/docs/rules/no-magic-numbers.md @@ -41,4 +41,28 @@ Examples of **correct** code for the `{ "ignoreNumericLiteralTypes": true }` opt type SmallPrimes = 2 | 3 | 5 | 7 | 11; ``` +### ignoreEnums + +A boolean to specify if enums used in Typescript are considered okay. `false` by default. + +Examples of **incorrect** code for the `{ "ignoreEnum": false }` option: + +```ts +/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreEnum": false }]*/ + +enum foo = { + SECOND = 1000, +} +``` + +Examples of **correct** code for the `{ "ignoreEnum": true }` option: + +```ts +/*eslint @typescript-eslint/no-magic-numbers: ["error", { "ignoreEnum": true }]*/ + +enum foo = { + SECOND = 1000, +} +``` + Taken with ❤️ [from ESLint core](https://github.com/eslint/eslint/blob/master/docs/rules/no-magic-numbers.md) diff --git a/packages/eslint-plugin/docs/rules/prefer-interface.md b/packages/eslint-plugin/docs/rules/prefer-interface.md index 39c8ca24321..8b995e6b06c 100644 --- a/packages/eslint-plugin/docs/rules/prefer-interface.md +++ b/packages/eslint-plugin/docs/rules/prefer-interface.md @@ -1,7 +1,9 @@ -# Prefer an interface declaration over a type literal (type T = { ... }) (prefer-interface) +# Prefer an interface declaration over a type literal (type T = { ... }) (prefer-interface)\ Interfaces are generally preferred over type literals because interfaces can be implemented, extended and merged. +## DEPRECATED - this rule has been deprecated in favour of [`consistent-type-definitions`](./consistent-type-definitions.md) + ## Rule Details Examples of **incorrect** code for this rule. diff --git a/packages/eslint-plugin/docs/rules/promise-function-async.md b/packages/eslint-plugin/docs/rules/promise-function-async.md index c64c25c11b5..e28de05742f 100644 --- a/packages/eslint-plugin/docs/rules/promise-function-async.md +++ b/packages/eslint-plugin/docs/rules/promise-function-async.md @@ -36,6 +36,7 @@ async function functionDeturnsPromise() { Options may be provided as an object with: +- `allowAny` to indicate that `any` or `unknown` shouldn't be considered Promises (`false` by default). - `allowedPromiseNames` to indicate any extra names of classes or interfaces to be considered Promises when returned. In addition, each of the following properties may be provided, and default to `true`: @@ -50,6 +51,7 @@ In addition, each of the following properties may be provided, and default to `t "@typescript-eslint/promise-function-async": [ "error", { + "allowAny": true, "allowedPromiseNames": ["Thenable"], "checkArrowFunctions": true, "checkFunctionDeclarations": true, diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 63f75be3334..d530f86a12b 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "1.10.2", + "version": "1.11.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -41,7 +41,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/experimental-utils": "1.10.2", + "@typescript-eslint/experimental-utils": "1.11.0", "eslint-utils": "^1.3.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^2.0.1", diff --git a/packages/eslint-plugin/src/configs/all.json b/packages/eslint-plugin/src/configs/all.json index 2f62af2b63f..6c1205551a8 100644 --- a/packages/eslint-plugin/src/configs/all.json +++ b/packages/eslint-plugin/src/configs/all.json @@ -9,6 +9,7 @@ "camelcase": "off", "@typescript-eslint/camelcase": "error", "@typescript-eslint/class-name-casing": "error", + "@typescript-eslint/consistent-type-definitions": "error", "@typescript-eslint/explicit-function-return-type": "error", "@typescript-eslint/explicit-member-accessibility": "error", "func-call-spacing": "off", @@ -23,11 +24,13 @@ "@typescript-eslint/no-angle-bracket-type-assertion": "error", "no-array-constructor": "off", "@typescript-eslint/no-array-constructor": "error", + "@typescript-eslint/no-empty-function": "error", "@typescript-eslint/no-empty-interface": "error", "@typescript-eslint/no-explicit-any": "error", "no-extra-parens": "off", "@typescript-eslint/no-extra-parens": "error", "@typescript-eslint/no-extraneous-class": "error", + "@typescript-eslint/no-floating-promises": "error", "@typescript-eslint/no-for-in-array": "error", "@typescript-eslint/no-inferrable-types": "error", "no-magic-numbers": "off", @@ -53,7 +56,6 @@ "@typescript-eslint/prefer-for-of": "error", "@typescript-eslint/prefer-function-type": "error", "@typescript-eslint/prefer-includes": "error", - "@typescript-eslint/prefer-interface": "error", "@typescript-eslint/prefer-namespace-keyword": "error", "@typescript-eslint/prefer-regexp-exec": "error", "@typescript-eslint/prefer-string-starts-ends-with": "error", diff --git a/packages/eslint-plugin/src/rules/consistent-type-definitions.ts b/packages/eslint-plugin/src/rules/consistent-type-definitions.ts new file mode 100644 index 00000000000..d8d9bb675a2 --- /dev/null +++ b/packages/eslint-plugin/src/rules/consistent-type-definitions.ts @@ -0,0 +1,103 @@ +import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; +import * as util from '../util'; + +export default util.createRule({ + name: 'consistent-type-definitions', + meta: { + type: 'suggestion', + docs: { + description: + 'Consistent with type definition either `interface` or `type`', + category: 'Stylistic Issues', + recommended: 'error', + }, + messages: { + interfaceOverType: 'Use an `interface` instead of a `type`', + typeOverInterface: 'Use a `type` instead of an `interface`', + }, + schema: [ + { + enum: ['interface', 'type'], + }, + ], + fixable: 'code', + }, + defaultOptions: ['interface'], + create(context, [option]) { + const sourceCode = context.getSourceCode(); + + return { + // VariableDeclaration with kind type has only one VariableDeclarator + "TSTypeAliasDeclaration[typeAnnotation.type='TSTypeLiteral']"( + node: TSESTree.TSTypeAliasDeclaration, + ) { + if (option === 'interface') { + context.report({ + node: node.id, + messageId: 'interfaceOverType', + fix(fixer) { + const typeNode = node.typeParameters || node.id; + const fixes: TSESLint.RuleFix[] = []; + + const firstToken = sourceCode.getFirstToken(node); + if (firstToken) { + fixes.push(fixer.replaceText(firstToken, 'interface')); + fixes.push( + fixer.replaceTextRange( + [typeNode.range[1], node.typeAnnotation.range[0]], + ' ', + ), + ); + } + + const afterToken = sourceCode.getTokenAfter(node.typeAnnotation); + if ( + afterToken && + afterToken.type === 'Punctuator' && + afterToken.value === ';' + ) { + fixes.push(fixer.remove(afterToken)); + } + + return fixes; + }, + }); + } + }, + TSInterfaceDeclaration(node) { + if (option === 'type') { + context.report({ + node: node.id, + messageId: 'typeOverInterface', + fix(fixer) { + const typeNode = node.typeParameters || node.id; + const fixes: TSESLint.RuleFix[] = []; + + const firstToken = sourceCode.getFirstToken(node); + if (firstToken) { + fixes.push(fixer.replaceText(firstToken, 'type')); + fixes.push( + fixer.replaceTextRange( + [typeNode.range[1], node.body.range[0]], + ' = ', + ), + ); + } + + if (node.extends) { + node.extends.forEach(heritage => { + const typeIdentifier = sourceCode.getText(heritage); + fixes.push( + fixer.insertTextAfter(node.body, ` & ${typeIdentifier}`), + ); + }); + } + + return fixes; + }, + }); + } + }, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/index.ts b/packages/eslint-plugin/src/rules/index.ts index aacbadae797..9630827e2e5 100644 --- a/packages/eslint-plugin/src/rules/index.ts +++ b/packages/eslint-plugin/src/rules/index.ts @@ -5,6 +5,7 @@ import banTsIgnore from './ban-ts-ignore'; import banTypes from './ban-types'; import camelcase from './camelcase'; import classNameCasing from './class-name-casing'; +import consistentTypeDefinitions from './consistent-type-definitions'; import explicitFunctionReturnType from './explicit-function-return-type'; import explicitMemberAccessibility from './explicit-member-accessibility'; import funcCallSpacing from './func-call-spacing'; @@ -16,6 +17,7 @@ import memberNaming from './member-naming'; import memberOrdering from './member-ordering'; import noAngleBracketTypeAssertion from './no-angle-bracket-type-assertion'; import noArrayConstructor from './no-array-constructor'; +import noEmptyFunction from './no-empty-function'; import noEmptyInterface from './no-empty-interface'; import noExplicitAny from './no-explicit-any'; import noExtraParens from './no-extra-parens'; @@ -63,6 +65,7 @@ export default { 'ban-types': banTypes, camelcase: camelcase, 'class-name-casing': classNameCasing, + 'consistent-type-definitions': consistentTypeDefinitions, 'explicit-function-return-type': explicitFunctionReturnType, 'explicit-member-accessibility': explicitMemberAccessibility, 'func-call-spacing': funcCallSpacing, @@ -74,6 +77,7 @@ export default { 'member-ordering': memberOrdering, 'no-angle-bracket-type-assertion': noAngleBracketTypeAssertion, 'no-array-constructor': noArrayConstructor, + 'no-empty-function': noEmptyFunction, 'no-empty-interface': noEmptyInterface, 'no-explicit-any': noExplicitAny, 'no-extra-parens': noExtraParens, diff --git a/packages/eslint-plugin/src/rules/no-empty-function.ts b/packages/eslint-plugin/src/rules/no-empty-function.ts new file mode 100644 index 00000000000..d64568a874f --- /dev/null +++ b/packages/eslint-plugin/src/rules/no-empty-function.ts @@ -0,0 +1,104 @@ +import { + TSESTree, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; +import baseRule from 'eslint/lib/rules/no-empty-function'; +import * as util from '../util'; + +type Options = util.InferOptionsTypeFromRule; +type MessageIds = util.InferMessageIdsTypeFromRule; + +export default util.createRule({ + name: 'no-empty-function', + meta: { + type: 'suggestion', + docs: { + description: 'Disallow empty functions', + category: 'Best Practices', + recommended: false, + }, + schema: baseRule.meta.schema, + messages: baseRule.meta.messages, + }, + defaultOptions: [ + { + allow: [], + }, + ], + create(context) { + const rules = baseRule.create(context); + + /** + * Checks if the node is a constructor + * @param node the node to ve validated + * @returns true if the node is a constructor + * @private + */ + function isConstructor( + node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, + ): boolean { + return !!( + node.parent && + node.parent.type === 'MethodDefinition' && + node.parent.kind === 'constructor' + ); + } + + /** + * Check if the method body is empty + * @param node the node to be validated + * @returns true if the body is empty + * @private + */ + function isBodyEmpty( + node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, + ): boolean { + return !node.body || node.body.body.length === 0; + } + + /** + * Check if method has parameter properties + * @param node the node to be validated + * @returns true if the body has parameter properties + * @private + */ + function hasParameterProperties( + node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, + ): boolean { + return ( + node.params && + node.params.some( + param => param.type === AST_NODE_TYPES.TSParameterProperty, + ) + ); + } + + /** + * Checks if the method is a concise constructor (no function body, but has parameter properties) + * @param node the node to be validated + * @returns true if the method is a concise constructor + * @private + */ + function isConciseConstructor( + node: TSESTree.FunctionDeclaration | TSESTree.FunctionExpression, + ) { + // Check TypeScript specific nodes + return ( + isConstructor(node) && isBodyEmpty(node) && hasParameterProperties(node) + ); + } + + return { + FunctionDeclaration(node: TSESTree.FunctionDeclaration) { + if (!isConciseConstructor(node)) { + rules.FunctionDeclaration(node); + } + }, + FunctionExpression(node: TSESTree.FunctionExpression) { + if (!isConciseConstructor(node)) { + rules.FunctionExpression(node); + } + }, + }; + }, +}); diff --git a/packages/eslint-plugin/src/rules/no-explicit-any.ts b/packages/eslint-plugin/src/rules/no-explicit-any.ts index 541b0acb1df..c27b4ab5992 100644 --- a/packages/eslint-plugin/src/rules/no-explicit-any.ts +++ b/packages/eslint-plugin/src/rules/no-explicit-any.ts @@ -1,3 +1,7 @@ +import { + TSESTree, + AST_NODE_TYPES, +} from '@typescript-eslint/experimental-utils'; import * as util from '../util'; export default util.createRule({ @@ -12,12 +16,145 @@ export default util.createRule({ messages: { unexpectedAny: 'Unexpected any. Specify a different type.', }, - schema: [], + schema: [ + { + type: 'object', + additionalProperties: false, + properties: { + ignoreRestArgs: { + type: 'boolean', + }, + }, + }, + ], }, - defaultOptions: [], - create(context) { + defaultOptions: [ + { + ignoreRestArgs: false, + }, + ], + create(context, [{ ignoreRestArgs }]) { + /** + * Checks if the node is an arrow function, function declaration or function expression + * @param node the node to be validated. + * @returns true if the node is an arrow function, function declaration or function expression + * @private + */ + function isNodeValidFunction(node: TSESTree.Node): boolean { + return [ + AST_NODE_TYPES.ArrowFunctionExpression, + AST_NODE_TYPES.FunctionDeclaration, + AST_NODE_TYPES.FunctionExpression, + ].includes(node.type); + } + + /** + * Checks if the node is a rest element child node of a function + * @param node the node to be validated. + * @returns true if the node is a rest element child node of a function + * @private + */ + function isNodeRestElementInFunction(node: TSESTree.Node): boolean { + return ( + node.type === AST_NODE_TYPES.RestElement && + typeof node.parent !== 'undefined' && + isNodeValidFunction(node.parent) + ); + } + + /** + * Checks if the node is a TSTypeOperator node with a readonly operator + * @param node the node to be validated. + * @returns true if the node is a TSTypeOperator node with a readonly operator + * @private + */ + function isNodeReadonlyTSTypeOperator(node: TSESTree.Node): boolean { + return ( + node.type === AST_NODE_TYPES.TSTypeOperator && + node.operator === 'readonly' + ); + } + + /** + * Checks if the node is a TSTypeReference node with an Array identifier + * @param node the node to be validated. + * @returns true if the node is a TSTypeReference node with an Array identifier + * @private + */ + function isNodeValidArrayTSTypeReference(node: TSESTree.Node): boolean { + return ( + node.type === AST_NODE_TYPES.TSTypeReference && + typeof node.typeName !== 'undefined' && + node.typeName.type === AST_NODE_TYPES.Identifier && + ['Array', 'ReadonlyArray'].includes(node.typeName.name) + ); + } + + /** + * Checks if the node is a valid TSTypeOperator or TSTypeReference node + * @param node the node to be validated. + * @returns true if the node is a valid TSTypeOperator or TSTypeReference node + * @private + */ + function isNodeValidTSType(node: TSESTree.Node): boolean { + return ( + isNodeReadonlyTSTypeOperator(node) || + isNodeValidArrayTSTypeReference(node) + ); + } + + /** + * Checks if the great grand-parent node is a RestElement node in a function + * @param node the node to be validated. + * @returns true if the great grand-parent node is a RestElement node in a function + * @private + */ + function isGreatGrandparentRestElement(node: TSESTree.Node): boolean { + return ( + typeof node.parent !== 'undefined' && + typeof node.parent.parent !== 'undefined' && + typeof node.parent.parent.parent !== 'undefined' && + isNodeRestElementInFunction(node.parent.parent.parent) + ); + } + + /** + * Checks if the great great grand-parent node is a valid RestElement node in a function + * @param node the node to be validated. + * @returns true if the great great grand-parent node is a valid RestElement node in a function + * @private + */ + function isGreatGreatGrandparentRestElement(node: TSESTree.Node): boolean { + return ( + typeof node.parent !== 'undefined' && + typeof node.parent.parent !== 'undefined' && + isNodeValidTSType(node.parent.parent) && + typeof node.parent.parent.parent !== 'undefined' && + typeof node.parent.parent.parent.parent !== 'undefined' && + isNodeRestElementInFunction(node.parent.parent.parent.parent) + ); + } + + /** + * Checks if the great grand-parent or the great great grand-parent node is a RestElement node + * @param node the node to be validated. + * @returns true if the great grand-parent or the great great grand-parent node is a RestElement node + * @private + */ + function isNodeDescendantOfRestElementInFunction( + node: TSESTree.Node, + ): boolean { + return ( + isGreatGrandparentRestElement(node) || + isGreatGreatGrandparentRestElement(node) + ); + } + return { TSAnyKeyword(node) { + if (ignoreRestArgs && isNodeDescendantOfRestElementInFunction(node)) { + return; + } context.report({ node, messageId: 'unexpectedAny', diff --git a/packages/eslint-plugin/src/rules/no-magic-numbers.ts b/packages/eslint-plugin/src/rules/no-magic-numbers.ts index f298bfd68f2..1880aa19c9d 100644 --- a/packages/eslint-plugin/src/rules/no-magic-numbers.ts +++ b/packages/eslint-plugin/src/rules/no-magic-numbers.ts @@ -29,6 +29,9 @@ export default util.createRule({ ignoreNumericLiteralTypes: { type: 'boolean', }, + ignoreEnums: { + type: 'boolean', + }, }, }, ], @@ -41,6 +44,7 @@ export default util.createRule({ enforceConst: false, detectObjects: false, ignoreNumericLiteralTypes: false, + ignoreEnums: false, }, ], create(context, [options]) { @@ -85,6 +89,19 @@ export default util.createRule({ return false; } + /** + * Checks if the node parent is a Typescript enum member + * @param node the node to be validated. + * @returns true if the node parent is a Typescript enum member + * @private + */ + function isParentTSEnumDeclaration(node: TSESTree.Node): boolean { + return ( + typeof node.parent !== 'undefined' && + node.parent.type === AST_NODE_TYPES.TSEnumMember + ); + } + /** * Checks if the node parent is a Typescript literal type * @param node the node to be validated. @@ -133,7 +150,12 @@ export default util.createRule({ return { Literal(node) { - // Check TypeScript specific nodes + // Check if the node is a TypeScript enum declaration + if (options.ignoreEnums && isParentTSEnumDeclaration(node)) { + return; + } + + // Check TypeScript specific nodes for Numeric Literal if ( options.ignoreNumericLiteralTypes && isNumber(node) && diff --git a/packages/eslint-plugin/src/rules/prefer-interface.ts b/packages/eslint-plugin/src/rules/prefer-interface.ts index 3197d579540..555e9646b2b 100644 --- a/packages/eslint-plugin/src/rules/prefer-interface.ts +++ b/packages/eslint-plugin/src/rules/prefer-interface.ts @@ -16,6 +16,8 @@ export default util.createRule({ interfaceOverType: 'Use an interface instead of a type literal.', }, schema: [], + deprecated: true, + replacedBy: ['consistent-type-definitions'], }, defaultOptions: [], create(context) { diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 885580c493f..4d5c96d76b4 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -3,6 +3,7 @@ import * as util from '../util'; type Options = [ { + allowAny?: boolean; allowedPromiseNames?: string[]; checkArrowFunctions?: boolean; checkFunctionDeclarations?: boolean; @@ -29,6 +30,9 @@ export default util.createRule({ { type: 'object', properties: { + allowAny: { + type: 'boolean', + }, allowedPromiseNames: { type: 'array', items: { @@ -54,6 +58,7 @@ export default util.createRule({ }, defaultOptions: [ { + allowAny: false, allowedPromiseNames: [], checkArrowFunctions: true, checkFunctionDeclarations: true, @@ -65,6 +70,7 @@ export default util.createRule({ context, [ { + allowAny, allowedPromiseNames, checkArrowFunctions, checkFunctionDeclarations, @@ -90,7 +96,9 @@ export default util.createRule({ } const returnType = checker.getReturnTypeOfSignature(signatures[0]); - if (!util.containsTypeByName(returnType, allAllowedPromiseNames)) { + if ( + !util.containsTypeByName(returnType, allowAny!, allAllowedPromiseNames) + ) { return; } diff --git a/packages/eslint-plugin/src/util/types.ts b/packages/eslint-plugin/src/util/types.ts index 04eb720126a..f10bda7f731 100644 --- a/packages/eslint-plugin/src/util/types.ts +++ b/packages/eslint-plugin/src/util/types.ts @@ -12,10 +12,11 @@ import ts from 'typescript'; */ export function containsTypeByName( type: ts.Type, + allowAny: boolean, allowedNames: Set, ): boolean { if (isTypeFlagSet(type, ts.TypeFlags.Any | ts.TypeFlags.Unknown)) { - return true; + return !allowAny; } if (isTypeReference(type)) { @@ -30,13 +31,13 @@ export function containsTypeByName( } if (isUnionOrIntersectionType(type)) { - return type.types.some(t => containsTypeByName(t, allowedNames)); + return type.types.some(t => containsTypeByName(t, allowAny, allowedNames)); } const bases = type.getBaseTypes(); return ( typeof bases !== 'undefined' && - bases.some(t => containsTypeByName(t, allowedNames)) + bases.some(t => containsTypeByName(t, allowAny, allowedNames)) ); } diff --git a/packages/eslint-plugin/tests/rules/consistent-type-definitions.test.ts b/packages/eslint-plugin/tests/rules/consistent-type-definitions.test.ts new file mode 100644 index 00000000000..b5daf40a90e --- /dev/null +++ b/packages/eslint-plugin/tests/rules/consistent-type-definitions.test.ts @@ -0,0 +1,209 @@ +import rule from '../../src/rules/consistent-type-definitions'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('consistent-type-definitions', rule, { + valid: [ + { + code: `var foo = { };`, + options: ['interface'], + }, + { + code: `interface A {}`, + options: ['interface'], + }, + { + code: `interface A extends B { x: number; }`, + options: ['interface'], + }, + { + code: `type U = string;`, + options: ['interface'], + }, + { + code: `type V = { x: number; } | { y: string; };`, + options: ['interface'], + }, + { + code: ` +type Record = { + [K in T]: U; +} +`, + options: ['interface'], + }, + { + code: `type V = { x: number; } | { y: string; };`, + options: ['interface'], + }, + { + code: `type T = { x: number; }`, + options: ['type'], + }, + { + code: `type T = { x: number; }`, + options: ['type'], + }, + { + code: `type T = { x: number; }`, + options: ['type'], + }, + { + code: `type A = { x: number; } & B & C;`, + options: ['type'], + }, + { + code: `type A = { x: number; } & B & C;`, + options: ['type'], + }, + { + code: ` +export type W = { + x: T, +}; +`, + options: ['type'], + }, + ], + invalid: [ + { + code: `type T = { x: number; };`, + output: `interface T { x: number; }`, + options: ['interface'], + errors: [ + { + messageId: 'interfaceOverType', + line: 1, + column: 6, + }, + ], + }, + { + code: `type T={ x: number; };`, + output: `interface T { x: number; }`, + options: ['interface'], + errors: [ + { + messageId: 'interfaceOverType', + line: 1, + column: 6, + }, + ], + }, + { + code: `type T= { x: number; };`, + output: `interface T { x: number; }`, + options: ['interface'], + errors: [ + { + messageId: 'interfaceOverType', + line: 1, + column: 6, + }, + ], + }, + { + code: ` +export type W = { + x: T, +}; +`, + output: ` +export interface W { + x: T, +} +`, + options: ['interface'], + errors: [ + { + messageId: 'interfaceOverType', + line: 2, + column: 13, + }, + ], + }, + { + code: `interface T { x: number; }`, + output: `type T = { x: number; }`, + options: ['type'], + errors: [ + { + messageId: 'typeOverInterface', + line: 1, + column: 11, + }, + ], + }, + { + code: `interface T{ x: number; }`, + output: `type T = { x: number; }`, + options: ['type'], + errors: [ + { + messageId: 'typeOverInterface', + line: 1, + column: 11, + }, + ], + }, + { + code: `interface T { x: number; }`, + output: `type T = { x: number; }`, + options: ['type'], + errors: [ + { + messageId: 'typeOverInterface', + line: 1, + column: 11, + }, + ], + }, + { + code: `interface A extends B, C { x: number; };`, + output: `type A = { x: number; } & B & C;`, + options: ['type'], + errors: [ + { + messageId: 'typeOverInterface', + line: 1, + column: 11, + }, + ], + }, + { + code: `interface A extends B, C { x: number; };`, + output: `type A = { x: number; } & B & C;`, + options: ['type'], + errors: [ + { + messageId: 'typeOverInterface', + line: 1, + column: 11, + }, + ], + }, + { + code: ` +export interface W { + x: T, +}; +`, + output: ` +export type W = { + x: T, +}; +`, + options: ['type'], + errors: [ + { + messageId: 'typeOverInterface', + line: 2, + column: 18, + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/no-empty-function.test.ts b/packages/eslint-plugin/tests/rules/no-empty-function.test.ts new file mode 100644 index 00000000000..4b40c170867 --- /dev/null +++ b/packages/eslint-plugin/tests/rules/no-empty-function.test.ts @@ -0,0 +1,69 @@ +import rule from '../../src/rules/no-empty-function'; +import { RuleTester } from '../RuleTester'; + +const ruleTester = new RuleTester({ + parser: '@typescript-eslint/parser', +}); + +ruleTester.run('no-empty-function', rule, { + valid: [ + { + code: `class Person { + private name: string + constructor(name: string) { + this.name = name; + } + }`, + }, + { + code: `class Person { + constructor(private name: string) {} + }`, + }, + { + code: `class Person { + constructor(name: string) {} + }`, + options: [{ allow: ['constructors'] }], + }, + { + code: `class Person { + otherMethod(name: string) {} + }`, + options: [{ allow: ['methods'] }], + }, + ], + + invalid: [ + { + code: `class Person { + constructor(name: string) {} + }`, + errors: [ + { + messageId: 'unexpected', + data: { + name: 'constructor', + }, + line: 2, + column: 35, + }, + ], + }, + { + code: `class Person { + otherMethod(name: string) {} + }`, + errors: [ + { + messageId: 'unexpected', + data: { + name: "method 'otherMethod'", + }, + line: 2, + column: 35, + }, + ], + }, + ], +}); diff --git a/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts b/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts index d892a310103..cf596ffecbc 100644 --- a/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts +++ b/packages/eslint-plugin/tests/rules/no-explicit-any.test.ts @@ -129,6 +129,63 @@ type obj = { message: string & Array>; } `, + // https://github.com/eslint/typescript-eslint-parser/issues/397 + { + code: ` + function foo(a: number, ...rest: any[]): void { + return; + } + `, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function foo1(...args: any[]) {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `const bar1 = function (...args: any[]) {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `const baz1 = (...args: any[]) => {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function foo2(...args: readonly any[]) {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `const bar2 = function (...args: readonly any[]) {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `const baz2 = (...args: readonly any[]) => {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function foo3(...args: Array) {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `const bar3 = function (...args: Array) {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `const baz3 = (...args: Array) => {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `function foo4(...args: ReadonlyArray) {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `const bar4 = function (...args: ReadonlyArray) {}`, + options: [{ ignoreRestArgs: true }], + }, + { + code: `const baz4 = (...args: ReadonlyArray) => {}`, + options: [{ ignoreRestArgs: true }], + }, ], invalid: [ { @@ -679,5 +736,53 @@ type obj = { }, ], }, + { + // https://github.com/eslint/typescript-eslint-parser/issues/397 + code: ` + function foo(a: number, ...rest: any[]): void { + return; + } + `, + errors: [ + { + messageId: 'unexpectedAny', + line: 2, + column: 42, + }, + ], + }, + { + code: `function foo5(...args: any) {}`, + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 24, + }, + ], + }, + { + code: `const bar5 = function (...args: any) {}`, + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 33, + }, + ], + }, + { + code: `const baz5 = (...args: any) => {}`, + options: [{ ignoreRestArgs: true }], + errors: [ + { + messageId: 'unexpectedAny', + line: 1, + column: 24, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts index 2b184ad76b2..09b6c35d0b4 100644 --- a/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts +++ b/packages/eslint-plugin/tests/rules/no-magic-numbers.test.ts @@ -33,6 +33,14 @@ ruleTester.run('no-magic-numbers', rule, { code: 'type Foo = 1 | -1;', options: [{ ignoreNumericLiteralTypes: true }], }, + { + code: 'enum foo { SECOND = 1000 }', + options: [{ ignoreEnums: true }], + }, + { + code: 'enum foo { SECOND = 1000, NUM = "0123456789" }', + options: [{ ignoreEnums: true }], + }, ], invalid: [ @@ -130,5 +138,33 @@ ruleTester.run('no-magic-numbers', rule, { }, ], }, + { + code: 'enum foo { SECOND = 1000 }', + options: [{ ignoreEnums: false }], + errors: [ + { + messageId: 'noMagic', + data: { + raw: '1000', + }, + line: 1, + column: 21, + }, + ], + }, + { + code: 'enum foo { SECOND = 1000, NUM = "0123456789" }', + options: [{ ignoreEnums: false }], + errors: [ + { + messageId: 'noMagic', + data: { + raw: '1000', + }, + line: 1, + column: 21, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts index 13b4a18c2e8..1b14ae5d131 100644 --- a/packages/eslint-plugin/tests/rules/promise-function-async.test.ts +++ b/packages/eslint-plugin/tests/rules/promise-function-async.test.ts @@ -30,7 +30,6 @@ const asyncPromiseFunctionExpressionB = async function() { return new Promise n; - public nonAsyncNonPromiseMethod() { return 0; } @@ -71,10 +70,58 @@ const invalidAsyncModifiers = { `export function valid(n: number) { return n; }`, `export default function invalid(n: number) { return n; }`, `class Foo { constructor() { } }`, + { + code: ` +function returnsAny(): any { + return 0; +} + `, + options: [ + { + allowAny: true, + }, + ], + }, + { + code: ` +function returnsUnknown(): unknown { + return 0; +} + `, + options: [ + { + allowAny: true, + }, + ], + }, ], invalid: [ { code: ` +function returnsAny(): any { + return 0; +} + `, + errors: [ + { + messageId, + }, + ], + }, + { + code: ` +function returnsUnknown(): unknown { + return 0; +} + `, + errors: [ + { + messageId, + }, + ], + }, + { + code: ` const nonAsyncPromiseFunctionExpressionA = function(p: Promise) { return p; }; `, errors: [ diff --git a/packages/eslint-plugin/tools/validate-docs/check-for-rule-docs.ts b/packages/eslint-plugin/tools/validate-docs/check-for-rule-docs.ts index 6012d46a3f1..eeb67c9d528 100644 --- a/packages/eslint-plugin/tools/validate-docs/check-for-rule-docs.ts +++ b/packages/eslint-plugin/tools/validate-docs/check-for-rule-docs.ts @@ -3,8 +3,8 @@ import fs from 'fs'; import path from 'path'; import { logRule } from './log'; -function checkForRuleDocs( - rules: Record>, +function checkForRuleDocs( + rules: Record>>, ): boolean { const ruleDocs = new Set( fs.readdirSync(path.resolve(__dirname, '../../docs/rules')), diff --git a/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts b/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts index 5268bc67556..1ab532e3160 100644 --- a/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts +++ b/packages/eslint-plugin/tools/validate-docs/validate-table-rules.ts @@ -5,8 +5,8 @@ import marked from 'marked'; import path from 'path'; import { logRule } from './log'; -function validateTableRules( - rules: Record>, +function validateTableRules( + rules: Record>>, rulesTable: marked.Tokens.Table, ): boolean { let hasErrors = false; diff --git a/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts b/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts index 4b5bb4151f4..02da5a66151 100644 --- a/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts +++ b/packages/eslint-plugin/tools/validate-docs/validate-table-structure.ts @@ -3,11 +3,13 @@ import chalk from 'chalk'; import marked from 'marked'; import { logError } from './log'; -function validateTableStructure( - rules: Record>, +function validateTableStructure( + rules: Record>>, rulesTable: marked.Tokens.Table, ): boolean { - const ruleNames = Object.keys(rules).sort(); + const ruleNames = Object.keys(rules) + .filter(ruleName => rules[ruleName].meta.deprecated !== true) + .sort(); let hasErrors = false; rulesTable.cells.forEach((row, rowIndex) => { diff --git a/packages/eslint-plugin/typings/eslint-rules.d.ts b/packages/eslint-plugin/typings/eslint-rules.d.ts index 98ee285d1a2..df9131dae4d 100644 --- a/packages/eslint-plugin/typings/eslint-rules.d.ts +++ b/packages/eslint-plugin/typings/eslint-rules.d.ts @@ -155,6 +155,24 @@ declare module 'eslint/lib/rules/no-dupe-args' { export = rule; } +declare module 'eslint/lib/rules/no-empty-function' { + import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; + + const rule: TSESLint.RuleModule< + 'unexpected', + [ + { + allow?: string[]; + } + ], + { + FunctionDeclaration(node: TSESTree.FunctionDeclaration): void; + FunctionExpression(node: TSESTree.FunctionExpression): void; + } + >; + export = rule; +} + declare module 'eslint/lib/rules/no-implicit-globals' { import { TSESLint, TSESTree } from '@typescript-eslint/experimental-utils'; @@ -180,6 +198,7 @@ declare module 'eslint/lib/rules/no-magic-numbers' { enforceConst?: boolean; detectObjects?: boolean; ignoreNumericLiteralTypes?: boolean; + ignoreEnums?: boolean; } ], { diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index e3d24945097..0726874992f 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) + + +### Bug Fixes + +* **eslint-plugin:** Remove duplicated code ([#611](https://github.com/typescript-eslint/typescript-eslint/issues/611)) ([c4df4ff](https://github.com/typescript-eslint/typescript-eslint/commit/c4df4ff)) + + +### Features + +* **eslint-plugin:** add `consistent-type-definitions` rule ([#463](https://github.com/typescript-eslint/typescript-eslint/issues/463)) ([ec87d06](https://github.com/typescript-eslint/typescript-eslint/commit/ec87d06)) + + + + + ## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) **Note:** Version bump only for package @typescript-eslint/experimental-utils diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index 060be982430..fa86431a8e0 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "1.10.2", + "version": "1.11.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -36,7 +36,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@typescript-eslint/typescript-estree": "1.10.2", + "@typescript-eslint/typescript-estree": "1.11.0", "eslint-scope": "^4.0.0" }, "peerDependencies": { diff --git a/packages/experimental-utils/src/ts-eslint/Rule.ts b/packages/experimental-utils/src/ts-eslint/Rule.ts index 388f64e99fc..2759a3d33d2 100644 --- a/packages/experimental-utils/src/ts-eslint/Rule.ts +++ b/packages/experimental-utils/src/ts-eslint/Rule.ts @@ -62,7 +62,7 @@ interface RuleMetaData { /** * The name of the rule this rule was replaced by, if it was deprecated. */ - replacedBy?: string; + replacedBy?: string[]; /** * The options schema. Supply an empty array if there are no options. */ diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 4d6efa2dcbe..3ed7f17edcf 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) + + +### Bug Fixes + +* **parser:** add simpleTraverse, replaces private ESLint util ([#628](https://github.com/typescript-eslint/typescript-eslint/issues/628)) ([aa206c4](https://github.com/typescript-eslint/typescript-eslint/commit/aa206c4)) +* **typescript-estree:** fix more cases with double slash in JSX text ([#607](https://github.com/typescript-eslint/typescript-eslint/issues/607)) ([34cfa53](https://github.com/typescript-eslint/typescript-eslint/commit/34cfa53)) + + + + + ## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 1193ffd06f0..e683453843b 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "1.10.2", + "version": "1.11.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/parser.js", "files": [ @@ -42,11 +42,11 @@ }, "dependencies": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "1.10.2", - "@typescript-eslint/typescript-estree": "1.10.2", + "@typescript-eslint/experimental-utils": "1.11.0", + "@typescript-eslint/typescript-estree": "1.11.0", "eslint-visitor-keys": "^1.0.0" }, "devDependencies": { - "@typescript-eslint/shared-fixtures": "1.10.2" + "@typescript-eslint/shared-fixtures": "1.11.0" } } diff --git a/packages/parser/src/parser.ts b/packages/parser/src/parser.ts index edc5d12bf67..11a68518d73 100644 --- a/packages/parser/src/parser.ts +++ b/packages/parser/src/parser.ts @@ -1,12 +1,12 @@ +import { TSESLint } from '@typescript-eslint/experimental-utils'; import { AST_NODE_TYPES, parseAndGenerateServices, - TSESTreeOptions, ParserServices, + TSESTreeOptions, } from '@typescript-eslint/typescript-estree'; -import { TSESLint } from '@typescript-eslint/experimental-utils'; -import traverser from 'eslint/lib/util/traverser'; import { analyzeScope } from './analyze-scope'; +import { simpleTraverse } from './simple-traverse'; import { visitorKeys } from './visitor-keys'; type ParserOptions = TSESLint.ParserOptions; @@ -87,7 +87,7 @@ export function parseForESLint( const { ast, services } = parseAndGenerateServices(code, parserOptions); ast.sourceType = options.sourceType; - traverser.traverse(ast, { + simpleTraverse(ast, { enter(node) { switch (node.type) { // Function#body cannot be null in ESTree spec. diff --git a/packages/parser/src/simple-traverse.ts b/packages/parser/src/simple-traverse.ts new file mode 100644 index 00000000000..8cc007058ad --- /dev/null +++ b/packages/parser/src/simple-traverse.ts @@ -0,0 +1,58 @@ +import { TSESTree } from '@typescript-eslint/typescript-estree'; +import { visitorKeys } from './visitor-keys'; + +function isValidNode(x: any): x is TSESTree.Node { + return x !== null && typeof x === 'object' && typeof x.type === 'string'; +} + +function getVisitorKeysForNode( + allVisitorKeys: typeof visitorKeys, + node: TSESTree.Node, +): readonly string[] { + const keys = allVisitorKeys[node.type]; + return keys || []; +} + +interface SimpleTraverseOptions { + enter: (node: TSESTree.Node, parent: TSESTree.Node | undefined) => void; +} + +class SimpleTraverser { + private allVisitorKeys = visitorKeys; + private enter: SimpleTraverseOptions['enter']; + + constructor({ enter }: SimpleTraverseOptions) { + this.enter = enter; + } + + traverse(node: unknown, parent: TSESTree.Node | undefined) { + if (!isValidNode(node)) { + return; + } + this.enter(node, parent); + + const keys = getVisitorKeysForNode(this.allVisitorKeys, node); + if (keys.length < 1) { + return; + } + + for (const key of keys) { + const childOrChildren = node[key as keyof typeof node]; + + if (Array.isArray(childOrChildren)) { + for (const child of childOrChildren) { + this.traverse(child, node); + } + } else { + this.traverse(childOrChildren, node); + } + } + } +} + +export function simpleTraverse( + startingNode: TSESTree.Node, + options: SimpleTraverseOptions, +) { + new SimpleTraverser(options).traverse(startingNode, undefined); +} diff --git a/packages/parser/tests/lib/__snapshots__/comments.ts.snap b/packages/parser/tests/lib/__snapshots__/comments.ts.snap index b38806f8d63..d04a7d39a32 100644 --- a/packages/parser/tests/lib/__snapshots__/comments.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/comments.ts.snap @@ -1171,7 +1171,7 @@ Object { } `; -exports[`Comments fixtures/jsx-block-comment.src 1`] = ` +exports[`Comments fixtures/jsx-attr-and-text-with-url.src 1`] = ` Object { "body": Array [ Object { @@ -1188,7 +1188,7 @@ Object { "line": 1, }, }, - "name": "pure", + "name": "link", "range": Array [ 6, 10, @@ -1196,234 +1196,174 @@ Object { "type": "Identifier", }, "init": Object { - "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": "JSXText", - "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": "JSXText", - "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", + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 6, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "start": Object { + "column": 43, + "line": 1, }, - "range": Array [ - 25, - 95, - ], - "type": "ReturnStatement", }, - ], + "range": Array [ + 43, + 61, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingElement": Object { "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 65, + "line": 1, }, "start": Object { - "column": 19, + "column": 61, "line": 1, }, }, + "name": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 63, + 64, + ], + "type": "JSXIdentifier", + }, "range": Array [ - 19, - 97, + 61, + 65, ], - "type": "BlockStatement", + "type": "JSXClosingElement", }, - "expression": false, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 65, + "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, - "params": Array [], - "range": Array [ - 13, - 97, - ], - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 7, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "href", + "range": Array [ + 17, + 21, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 17, + 42, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 42, + ], + "raw": "\\"http://example.com\\"", + "type": "Literal", + "value": "http://example.com", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 15, + 16, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 14, + 43, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 14, + 65, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 66, + "line": 1, }, "start": Object { "column": 6, @@ -1432,7 +1372,7 @@ Object { }, "range": Array [ 6, - 97, + 66, ], "type": "VariableDeclarator", }, @@ -1440,8 +1380,8 @@ Object { "kind": "const", "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 67, + "line": 1, }, "start": Object { "column": 0, @@ -1450,35 +1390,16 @@ Object { }, "range": Array [ 0, - 97, + 67, ], "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", - }, - ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 8, + "line": 2, }, "start": Object { "column": 0, @@ -1487,7 +1408,7 @@ Object { }, "range": Array [ 0, - 98, + 68, ], "sourceType": "module", "tokens": Array [ @@ -1525,7 +1446,7 @@ Object { 10, ], "type": "Identifier", - "value": "pure", + "value": "link", }, Object { "loc": Object { @@ -1579,89 +1500,89 @@ Object { 15, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 18, ], - "type": "Punctuator", - "value": "=>", + "type": "JSXIdentifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 21, "line": 1, }, "start": Object { - "column": 19, + "column": 17, "line": 1, }, }, "range": Array [ - 19, - 20, + 17, + 21, ], - "type": "Punctuator", - "value": "{", + "type": "JSXIdentifier", + "value": "href", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 25, - 31, + 21, + 22, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 42, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 32, - 33, + 22, + 42, ], - "type": "Punctuator", - "value": "(", + "type": "JSXText", + "value": "\\"http://example.com\\"", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 43, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 42, + "line": 1, }, }, "range": Array [ @@ -1669,186 +1590,94 @@ Object { 43, ], "type": "Punctuator", - "value": "<", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 61, + "line": 1, }, "start": Object { - "column": 9, - "line": 3, + "column": 43, + "line": 1, }, }, "range": Array [ 43, - 46, + 61, ], - "type": "JSXIdentifier", - "value": "Foo", + "type": "JSXText", + "value": "http://example.com", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 62, + "line": 1, }, "start": Object { - "column": 12, - "line": 3, + "column": 61, + "line": 1, }, }, "range": Array [ - 46, - 47, + 61, + 62, ], "type": "Punctuator", - "value": ">", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 63, + "line": 1, }, "start": Object { - "column": 13, - "line": 3, + "column": 62, + "line": 1, }, }, "range": Array [ - 47, - 60, + 62, + 63, ], - "type": "JSXText", - "value": " - ", + "type": "Punctuator", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 64, + "line": 1, }, "start": Object { - "column": 12, - "line": 4, - }, - }, - "range": Array [ - 60, - 61, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 24, - "line": 4, - }, - }, - "range": Array [ - 72, - 73, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 25, - "line": 4, - }, - }, - "range": Array [ - 73, - 82, - ], - "type": "JSXText", - "value": " - ", - }, - 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, + "column": 63, + "line": 1, }, }, "range": Array [ - 84, - 87, + 63, + 64, ], "type": "JSXIdentifier", - "value": "Foo", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 5, + "column": 65, + "line": 1, }, "start": Object { - "column": 13, - "line": 5, + "column": 64, + "line": 1, }, }, "range": Array [ - 87, - 88, + 64, + 65, ], "type": "Punctuator", "value": ">", @@ -1856,17 +1685,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 66, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 65, + "line": 1, }, }, "range": Array [ - 93, - 94, + 65, + 66, ], "type": "Punctuator", "value": ")", @@ -1874,45 +1703,27 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, - "line": 6, + "column": 67, + "line": 1, }, "start": Object { - "column": 5, - "line": 6, + "column": 66, + "line": 1, }, }, "range": Array [ - 94, - 95, + 66, + 67, ], "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": "}", - }, ], "type": "Program", } `; -exports[`Comments fixtures/jsx-comment-after-jsx.src 1`] = ` +exports[`Comments fixtures/jsx-block-comment.src 1`] = ` Object { "body": Array [ Object { @@ -1942,99 +1753,176 @@ Object { "body": Array [ Object { "argument": Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 3, - }, - }, - "name": Object { + "children": Array [ + Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 12, + "line": 4, }, "start": Object { - "column": 15, + "column": 13, "line": 3, }, }, - "name": "Foo", "range": Array [ - 49, - 52, + 47, + 60, ], - "type": "JSXIdentifier", - }, - "range": Array [ - 47, - 53, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, + "raw": " + ", + "type": "JSXText", + "value": " + ", }, - }, - "openingElement": Object { - "attributes": Array [], - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 61, + 72, + ], + "type": "JSXEmptyExpression", }, - }, - "name": Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 25, + "line": 4, }, "start": Object { - "column": 9, - "line": 3, + "column": 12, + "line": 4, }, }, - "name": "Foo", "range": Array [ - 43, - 46, + 60, + 73, ], - "type": "JSXIdentifier", + "type": "JSXExpressionContainer", }, - "range": Array [ - 42, - 47, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - }, - "range": Array [ - 42, - 53, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 73, + 82, + ], + "raw": " + ", + "type": "JSXText", + "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", }, "loc": Object { "end": Object { "column": 6, - "line": 4, + "line": 6, }, "start": Object { "column": 4, @@ -2043,7 +1931,7 @@ Object { }, "range": Array [ 25, - 67, + 95, ], "type": "ReturnStatement", }, @@ -2051,7 +1939,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 7, }, "start": Object { "column": 19, @@ -2060,7 +1948,7 @@ Object { }, "range": Array [ 19, - 69, + 97, ], "type": "BlockStatement", }, @@ -2070,7 +1958,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 7, }, "start": Object { "column": 13, @@ -2080,14 +1968,14 @@ Object { "params": Array [], "range": Array [ 13, - 69, + 97, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 7, }, "start": Object { "column": 6, @@ -2096,7 +1984,7 @@ Object { }, "range": Array [ 6, - 69, + 97, ], "type": "VariableDeclarator", }, @@ -2105,7 +1993,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 7, }, "start": Object { "column": 0, @@ -2114,7 +2002,7 @@ Object { }, "range": Array [ 0, - 69, + 97, ], "type": "VariableDeclaration", }, @@ -2123,26 +2011,26 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 3, + "column": 24, + "line": 4, }, "start": Object { - "column": 20, - "line": 3, + "column": 13, + "line": 4, }, }, "range": Array [ - 54, - 60, + 61, + 72, ], - "type": "Line", - "value": " Foo", + "type": "Block", + "value": "COMMENT", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 8, }, "start": Object { "column": 0, @@ -2151,7 +2039,7 @@ Object { }, "range": Array [ 0, - 70, + 98, ], "sourceType": "module", "tokens": Array [ @@ -2374,8 +2262,8 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 12, + "line": 4, }, "start": Object { "column": 13, @@ -2384,131 +2272,205 @@ Object { }, "range": Array [ 47, - 48, + 60, ], - "type": "Punctuator", - "value": "<", + "type": "JSXText", + "value": " + ", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 13, + "line": 4, }, "start": Object { - "column": 14, - "line": 3, + "column": 12, + "line": 4, }, }, "range": Array [ - 48, - 49, + 60, + 61, ], "type": "Punctuator", - "value": "/", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 4, }, "start": Object { - "column": 15, - "line": 3, + "column": 24, + "line": 4, }, }, "range": Array [ - 49, - 52, + 72, + 73, ], - "type": "JSXIdentifier", - "value": "Foo", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 8, + "line": 5, }, "start": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 4, }, }, "range": Array [ - 52, - 53, + 73, + 82, ], - "type": "Punctuator", - "value": ">", + "type": "JSXText", + "value": " + ", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 9, + "line": 5, }, "start": Object { - "column": 4, - "line": 4, + "column": 8, + "line": 5, }, }, "range": Array [ - 65, - 66, + 82, + 83, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 4, + "column": 10, + "line": 5, }, "start": Object { - "column": 5, - "line": 4, + "column": 9, + "line": 5, }, }, "range": Array [ - 66, - 67, + 83, + 84, ], "type": "Punctuator", - "value": ";", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 13, "line": 5, }, "start": Object { - "column": 0, + "column": 10, "line": 5, }, }, "range": Array [ - 68, - 69, + 84, + 87, ], - "type": "Punctuator", - "value": "}", + "type": "JSXIdentifier", + "value": "Foo", }, - ], - "type": "Program", -} -`; - -exports[`Comments fixtures/jsx-comment-after-self-closing-jsx.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": 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": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/jsx-comment-after-jsx.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { "column": 10, @@ -2533,10 +2495,44 @@ Object { Object { "argument": Object { "children": Array [], - "closingElement": null, + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 49, + 52, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 47, + 53, + ], + "type": "JSXClosingElement", + }, "loc": Object { "end": Object { - "column": 15, + "column": 19, "line": 3, }, "start": Object { @@ -2548,7 +2544,7 @@ Object { "attributes": Array [], "loc": Object { "end": Object { - "column": 15, + "column": 13, "line": 3, }, "start": Object { @@ -2576,14 +2572,14 @@ Object { }, "range": Array [ 42, - 49, + 47, ], - "selfClosing": true, + "selfClosing": false, "type": "JSXOpeningElement", }, "range": Array [ 42, - 49, + 53, ], "type": "JSXElement", }, @@ -2599,7 +2595,7 @@ Object { }, "range": Array [ 25, - 63, + 67, ], "type": "ReturnStatement", }, @@ -2616,7 +2612,7 @@ Object { }, "range": Array [ 19, - 65, + 69, ], "type": "BlockStatement", }, @@ -2636,7 +2632,7 @@ Object { "params": Array [], "range": Array [ 13, - 65, + 69, ], "type": "ArrowFunctionExpression", }, @@ -2652,7 +2648,7 @@ Object { }, "range": Array [ 6, - 65, + 69, ], "type": "VariableDeclarator", }, @@ -2670,7 +2666,7 @@ Object { }, "range": Array [ 0, - 65, + 69, ], "type": "VariableDeclaration", }, @@ -2679,17 +2675,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 3, }, "start": Object { - "column": 16, + "column": 20, "line": 3, }, }, "range": Array [ - 50, - 56, + 54, + 60, ], "type": "Line", "value": " Foo", @@ -2707,7 +2703,7 @@ Object { }, "range": Array [ 0, - 66, + 70, ], "sourceType": "module", "tokens": Array [ @@ -2909,6 +2905,24 @@ Object { "type": "JSXIdentifier", "value": "Foo", }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ">", + }, Object { "loc": Object { "end": Object { @@ -2925,7 +2939,7 @@ Object { 48, ], "type": "Punctuator", - "value": "/", + "value": "<", }, Object { "loc": Object { @@ -2943,6 +2957,42 @@ Object { 49, ], "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", "value": ">", }, Object { @@ -2957,8 +3007,8 @@ Object { }, }, "range": Array [ - 61, - 62, + 65, + 66, ], "type": "Punctuator", "value": ")", @@ -2975,8 +3025,8 @@ Object { }, }, "range": Array [ - 62, - 63, + 66, + 67, ], "type": "Punctuator", "value": ";", @@ -2993,8 +3043,8 @@ Object { }, }, "range": Array [ - 64, - 65, + 68, + 69, ], "type": "Punctuator", "value": "}", @@ -3004,7 +3054,7 @@ Object { } `; -exports[`Comments fixtures/jsx-generic-with-comment-in-tag.src 1`] = ` +exports[`Comments fixtures/jsx-comment-after-self-closing-jsx.src 1`] = ` Object { "body": Array [ Object { @@ -3021,7 +3071,7 @@ Object { "line": 1, }, }, - "name": "comp", + "name": "pure", "range": Array [ 6, 10, @@ -3029,792 +3079,1294 @@ Object { "type": "Identifier", }, "init": Object { - "children": Array [ - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 19, - 24, - ], - "raw": " - ", - "type": "JSXText", - "value": " - ", - }, - Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 3, - }, - "start": Object { - "column": 38, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 40, - "line": 3, - }, - }, - "name": "Component", - "range": Array [ - 60, - 69, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 58, - 70, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 50, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "openingElement": Object { - "attributes": Array [], - "loc": Object { - "end": Object { - "column": 38, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "Component", - "range": Array [ - 25, - 34, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 24, - 58, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - "typeParameters": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [], + "closingElement": null, "loc": Object { "end": Object { - "column": 22, + "column": 15, "line": 3, }, "start": Object { - "column": 14, + "column": 8, "line": 3, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 35, - 41, - ], - "type": "TSNumberKeyword", - }, - ], - "range": Array [ - 34, - 42, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "range": Array [ - 24, - 70, - ], - "type": "JSXElement", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 4, - }, - "start": Object { - "column": 50, - "line": 3, - }, - }, - "range": Array [ - 70, - 75, - ], - "raw": " - ", - "type": "JSXText", - "value": " - ", - }, - Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 4, - }, - "start": Object { - "column": 42, - "line": 4, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 4, - }, - "start": Object { - "column": 44, - "line": 4, - }, - }, - "name": "Component", - "range": Array [ - 115, - 124, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 113, - 125, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 54, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "openingElement": Object { - "attributes": Array [ - Object { + "openingElement": Object { + "attributes": Array [], "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 15, + "line": 3, }, "start": Object { - "column": 23, - "line": 4, + "column": 8, + "line": 3, }, }, "name": Object { "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 12, + "line": 3, }, "start": Object { - "column": 23, - "line": 4, + "column": 9, + "line": 3, }, }, - "name": "foo", + "name": "Foo", "range": Array [ - 94, - 97, + 43, + 46, ], "type": "JSXIdentifier", }, "range": Array [ - 94, - 97, + 42, + 49, ], - "type": "JSXAttribute", - "value": null, + "selfClosing": true, + "type": "JSXOpeningElement", }, - ], + "range": Array [ + 42, + 49, + ], + "type": "JSXElement", + }, "loc": Object { "end": Object { - "column": 42, + "column": 6, "line": 4, }, "start": Object { "column": 4, - "line": 4, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, + "line": 2, }, - "name": "Component", - "range": Array [ - 76, - 85, - ], - "type": "JSXIdentifier", }, "range": Array [ - 75, - 113, + 25, + 63, ], - "selfClosing": false, - "type": "JSXOpeningElement", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 4, - }, - "start": Object { - "column": 15, - "line": 4, - }, - }, - "range": Array [ - 86, - 92, - ], - "type": "TSNumberKeyword", - }, - ], - "range": Array [ - 85, - 93, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "range": Array [ - 75, - 125, - ], - "type": "JSXElement", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 5, - }, - "start": Object { - "column": 54, - "line": 4, - }, - }, - "range": Array [ - 125, - 130, - ], - "raw": " - ", - "type": "JSXText", - "value": " - ", - }, - Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { - "column": 42, - "line": 5, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 5, - }, - "start": Object { - "column": 44, - "line": 5, - }, - }, - "name": "Component", - "range": Array [ - 170, - 179, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 168, - 180, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, + "type": "ReturnStatement", }, - "openingElement": Object { - "attributes": Array [ - Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 5, - }, - "start": Object { - "column": 38, - "line": 5, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 5, - }, - "start": Object { - "column": 38, - "line": 5, - }, - }, - "name": "bar", - "range": Array [ - 164, - 167, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 164, - 167, - ], - "type": "JSXAttribute", - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 5, - }, - "start": Object { - "column": 5, - "line": 5, - }, - }, - "name": "Component", - "range": Array [ - 131, - 140, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 130, - 168, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 15, - "line": 5, - }, - }, - "range": Array [ - 141, - 147, - ], - "type": "TSNumberKeyword", - }, - ], - "range": Array [ - 140, - 148, - ], - "type": "TSTypeParameterInstantiation", - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, }, - "range": Array [ - 130, - 180, - ], - "type": "JSXElement", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 6, - }, - "start": Object { - "column": 54, - "line": 5, - }, + "start": Object { + "column": 19, + "line": 1, }, - "range": Array [ - 180, - 185, - ], - "raw": " - ", - "type": "JSXText", - "value": " - ", }, - Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 58, - "line": 6, - }, - "start": Object { - "column": 46, - "line": 6, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 6, - }, - "start": Object { - "column": 48, - "line": 6, - }, - }, - "name": "Component", - "range": Array [ - 229, - 238, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 227, - 239, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 58, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "openingElement": Object { - "attributes": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 6, - }, - "start": Object { - "column": 23, - "line": 6, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 6, - }, - "start": Object { - "column": 23, - "line": 6, - }, - }, - "name": "foo", - "range": Array [ - 204, - 207, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 204, - 207, - ], - "type": "JSXAttribute", - "value": null, - }, - Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 6, - }, - "start": Object { - "column": 42, - "line": 6, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 6, - }, - "start": Object { - "column": 42, - "line": 6, - }, - }, - "name": "bar", - "range": Array [ - 223, - 226, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 223, - 226, - ], - "type": "JSXAttribute", - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 46, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 6, - }, - "start": Object { - "column": 5, - "line": 6, - }, - }, - "name": "Component", - "range": Array [ - 186, - 195, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 185, - 227, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 6, - }, - "start": Object { - "column": 14, - "line": 6, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 6, - }, - "start": Object { - "column": 15, - "line": 6, - }, - }, - "range": Array [ - 196, - 202, - ], - "type": "TSNumberKeyword", - }, - ], - "range": Array [ - 195, - 203, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "range": Array [ - 185, - 239, - ], - "type": "JSXElement", + "range": Array [ + 19, + 65, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 8, - }, - "start": Object { - "column": 58, - "line": 6, - }, - }, - "range": Array [ - 239, - 245, - ], - "raw": " - - ", - "type": "JSXText", - "value": " - - ", + "start": Object { + "column": 13, + "line": 1, }, - Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 10, - }, - "start": Object { - "column": 5, - "line": 10, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 10, - }, - "start": Object { - "column": 7, - "line": 10, - }, - }, - "name": "Component", - "range": Array [ - 289, + }, + "params": Array [], + "range": Array [ + 13, + 65, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 65, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "Line", + "value": " Foo", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "sourceType": "module", + "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": "Identifier", + "value": "pure", + }, + 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": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 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": 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": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "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[`Comments fixtures/jsx-generic-with-comment-in-tag.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "comp", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "name": "Component", + "range": Array [ + 60, + 69, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 58, + 70, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "Component", + "range": Array [ + 25, + 34, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 24, + 58, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 34, + 42, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 24, + 70, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 50, + "line": 3, + }, + }, + "range": Array [ + 70, + 75, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 4, + }, + "start": Object { + "column": 42, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 44, + "line": 4, + }, + }, + "name": "Component", + "range": Array [ + 115, + 124, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 113, + 125, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 54, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "name": "foo", + "range": Array [ + 94, + 97, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 94, + 97, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "Component", + "range": Array [ + 76, + 85, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 75, + 113, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 86, + 92, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 85, + 93, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 75, + 125, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 4, + }, + }, + "range": Array [ + 125, + 130, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 5, + }, + "start": Object { + "column": 44, + "line": 5, + }, + }, + "name": "Component", + "range": Array [ + 170, + 179, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 168, + 180, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "name": "bar", + "range": Array [ + 164, + 167, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 164, + 167, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "name": "Component", + "range": Array [ + 131, + 140, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 130, + 168, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 141, + 147, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 140, + 148, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 130, + 180, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 180, + 185, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 6, + }, + "start": Object { + "column": 46, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 6, + }, + "start": Object { + "column": 48, + "line": 6, + }, + }, + "name": "Component", + "range": Array [ + 229, + 238, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 227, + 239, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 58, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 204, + 207, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 204, + 207, + ], + "type": "JSXAttribute", + "value": null, + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "name": "bar", + "range": Array [ + 223, + 226, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 223, + 226, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 46, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "name": "Component", + "range": Array [ + 186, + 195, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 185, + 227, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 196, + 202, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 195, + 203, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 185, + 239, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 8, + }, + "start": Object { + "column": 58, + "line": 6, + }, + }, + "range": Array [ + 239, + 245, + ], + "raw": " + + ", + "type": "JSXText", + "value": " + + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 10, + }, + "start": Object { + "column": 5, + "line": 10, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 7, + "line": 10, + }, + }, + "name": "Component", + "range": Array [ + 289, 298, ], "type": "JSXIdentifier", @@ -4591,290 +5143,1358 @@ Object { "type": "VariableDeclarator", }, ], - "kind": "const", + "kind": "const", + "loc": Object { + "end": Object { + "column": 2, + "line": 25, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 525, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 43, + 57, + ], + "type": "Block", + "value": " comment1 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 98, + 112, + ], + "type": "Block", + "value": " comment2 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 149, + 163, + ], + "type": "Block", + "value": " comment3 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 208, + 222, + ], + "type": "Block", + "value": " comment4 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 270, + 281, + ], + "type": "Line", + "value": " comment5", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 13, + }, + "start": Object { + "column": 6, + "line": 13, + }, + }, + "range": Array [ + 339, + 350, + ], + "type": "Line", + "value": " comment6", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 16, + }, + "start": Object { + "column": 6, + "line": 16, + }, + }, + "range": Array [ + 398, + 409, + ], + "type": "Line", + "value": " comment7", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 21, + }, + "start": Object { + "column": 6, + "line": 21, + }, + }, + "range": Array [ + 477, + 488, + ], + "type": "Line", + "value": " comment8", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 26, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 526, + ], + "sourceType": "module", + "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": "Identifier", + "value": "comp", + }, + 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": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 25, + 34, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 50, + "line": 3, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 76, + 85, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 86, + 92, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 94, + 97, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 4, + }, + "start": Object { + "column": 42, + "line": 4, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 4, + }, + "start": Object { + "column": 43, + "line": 4, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 44, + "line": 4, + }, + }, + "range": Array [ + 115, + 124, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 4, + }, + "start": Object { + "column": 53, + "line": 4, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 4, + }, + }, + "range": Array [ + 125, + 130, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 131, + 140, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 141, + 147, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 164, + 167, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 41, + "line": 5, + }, + }, + "range": Array [ + 167, + 168, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 5, + }, + "start": Object { + "column": 43, + "line": 5, + }, + }, + "range": Array [ + 169, + 170, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 5, + }, + "start": Object { + "column": 44, + "line": 5, + }, + }, + "range": Array [ + 170, + 179, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 53, + "line": 5, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 180, + 185, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 185, + 186, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 186, + 195, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 196, + 202, + ], + "type": "Identifier", + "value": "number", + }, + Object { "loc": Object { "end": Object { - "column": 2, - "line": 25, + "column": 22, + "line": 6, }, "start": Object { - "column": 0, - "line": 1, + "column": 21, + "line": 6, }, }, "range": Array [ - 0, - 525, + 202, + 203, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": ">", }, - ], - "comments": Array [ Object { "loc": Object { "end": Object { - "column": 37, - "line": 3, + "column": 26, + "line": 6, }, "start": Object { "column": 23, - "line": 3, + "line": 6, }, }, "range": Array [ - 43, - 57, + 204, + 207, ], - "type": "Block", - "value": " comment1 ", + "type": "JSXIdentifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 4, + "column": 45, + "line": 6, }, "start": Object { - "column": 27, - "line": 4, + "column": 42, + "line": 6, }, }, "range": Array [ - 98, - 112, + 223, + 226, ], - "type": "Block", - "value": " comment2 ", + "type": "JSXIdentifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 5, + "column": 46, + "line": 6, }, "start": Object { - "column": 23, - "line": 5, + "column": 45, + "line": 6, }, }, "range": Array [ - 149, - 163, + 226, + 227, ], - "type": "Block", - "value": " comment3 ", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 47, "line": 6, }, "start": Object { - "column": 27, + "column": 46, "line": 6, }, }, "range": Array [ - 208, - 222, + 227, + 228, ], - "type": "Block", - "value": " comment4 ", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 9, + "column": 48, + "line": 6, }, "start": Object { - "column": 6, - "line": 9, + "column": 47, + "line": 6, }, }, "range": Array [ - 270, - 281, + 228, + 229, ], - "type": "Line", - "value": " comment5", + "type": "Punctuator", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 13, + "column": 57, + "line": 6, }, "start": Object { - "column": 6, - "line": 13, + "column": 48, + "line": 6, }, }, "range": Array [ - 339, - 350, + 229, + 238, ], - "type": "Line", - "value": " comment6", + "type": "JSXIdentifier", + "value": "Component", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 16, + "column": 58, + "line": 6, }, "start": Object { - "column": 6, - "line": 16, + "column": 57, + "line": 6, }, }, "range": Array [ - 398, - 409, + 238, + 239, ], - "type": "Line", - "value": " comment7", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 21, + "column": 4, + "line": 8, }, "start": Object { - "column": 6, - "line": 21, + "column": 58, + "line": 6, }, }, "range": Array [ - 477, - 488, + 239, + 245, ], - "type": "Line", - "value": " comment8", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 26, + "type": "JSXText", + "value": " + + ", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 245, + 246, + ], + "type": "Punctuator", + "value": "<", }, - }, - "range": Array [ - 0, - 526, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { "column": 5, - "line": 1, + "line": 8, + }, + }, + "range": Array [ + 246, + 255, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 8, }, }, "range": Array [ - 0, - 5, + 255, + 256, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 256, + 262, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 8, + }, + "start": Object { + "column": 21, + "line": 8, + }, + }, + "range": Array [ + 262, + 263, + ], + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 5, + "line": 10, }, "start": Object { - "column": 6, - "line": 1, + "column": 4, + "line": 10, }, }, "range": Array [ - 6, - 10, + 286, + 287, ], - "type": "Identifier", - "value": "comp", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 6, + "line": 10, }, "start": Object { - "column": 11, - "line": 1, + "column": 5, + "line": 10, }, }, "range": Array [ - 11, - 12, + 287, + 288, ], "type": "Punctuator", - "value": "=", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 7, + "line": 10, }, "start": Object { - "column": 13, - "line": 1, + "column": 6, + "line": 10, }, }, "range": Array [ - 13, - 14, + 288, + 289, ], "type": "Punctuator", - "value": "(", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 16, + "line": 10, }, "start": Object { - "column": 2, - "line": 2, + "column": 7, + "line": 10, }, }, "range": Array [ - 17, - 18, + 289, + 298, ], - "type": "Punctuator", - "value": "<", + "type": "JSXIdentifier", + "value": "Component", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 10, }, "start": Object { - "column": 3, - "line": 2, + "column": 16, + "line": 10, }, }, "range": Array [ - 18, - 19, + 298, + 299, ], "type": "Punctuator", "value": ">", @@ -4883,16 +6503,16 @@ Object { "loc": Object { "end": Object { "column": 4, - "line": 3, + "line": 11, }, "start": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 10, }, }, "range": Array [ - 19, - 24, + 299, + 304, ], "type": "JSXText", "value": " @@ -4902,16 +6522,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 3, + "line": 11, }, "start": Object { "column": 4, - "line": 3, + "line": 11, }, }, "range": Array [ - 24, - 25, + 304, + 305, ], "type": "Punctuator", "value": "<", @@ -4920,16 +6540,16 @@ Object { "loc": Object { "end": Object { "column": 14, - "line": 3, + "line": 11, }, "start": Object { "column": 5, - "line": 3, + "line": 11, }, }, "range": Array [ - 25, - 34, + 305, + 314, ], "type": "JSXIdentifier", "value": "Component", @@ -4938,16 +6558,16 @@ Object { "loc": Object { "end": Object { "column": 15, - "line": 3, + "line": 11, }, "start": Object { "column": 14, - "line": 3, + "line": 11, }, }, "range": Array [ - 34, - 35, + 314, + 315, ], "type": "Punctuator", "value": "<", @@ -4956,16 +6576,16 @@ Object { "loc": Object { "end": Object { "column": 21, - "line": 3, + "line": 11, }, "start": Object { "column": 15, - "line": 3, + "line": 11, }, }, "range": Array [ - 35, - 41, + 315, + 321, ], "type": "Identifier", "value": "number", @@ -4974,16 +6594,16 @@ Object { "loc": Object { "end": Object { "column": 22, - "line": 3, + "line": 11, }, "start": Object { "column": 21, - "line": 3, + "line": 11, }, }, "range": Array [ - 41, - 42, + 321, + 322, ], "type": "Punctuator", "value": ">", @@ -4991,17 +6611,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 3, + "column": 9, + "line": 12, }, "start": Object { - "column": 37, - "line": 3, + "column": 6, + "line": 12, }, }, "range": Array [ - 57, - 58, + 329, + 332, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 355, + 356, ], "type": "Punctuator", "value": ">", @@ -5009,17 +6647,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 3, + "column": 6, + "line": 14, }, "start": Object { - "column": 38, - "line": 3, + "column": 5, + "line": 14, }, }, "range": Array [ - 58, - 59, + 356, + 357, ], "type": "Punctuator", "value": "<", @@ -5027,17 +6665,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 40, - "line": 3, + "column": 7, + "line": 14, }, "start": Object { - "column": 39, - "line": 3, + "column": 6, + "line": 14, }, }, "range": Array [ - 59, - 60, + 357, + 358, ], "type": "Punctuator", "value": "/", @@ -5045,17 +6683,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 49, - "line": 3, + "column": 16, + "line": 14, }, "start": Object { - "column": 40, - "line": 3, + "column": 7, + "line": 14, }, }, "range": Array [ - 60, - 69, + 358, + 367, ], "type": "JSXIdentifier", "value": "Component", @@ -5063,17 +6701,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 50, - "line": 3, + "column": 17, + "line": 14, }, "start": Object { - "column": 49, - "line": 3, + "column": 16, + "line": 14, }, }, "range": Array [ - 69, - 70, + 367, + 368, ], "type": "Punctuator", "value": ">", @@ -5082,16 +6720,16 @@ Object { "loc": Object { "end": Object { "column": 4, - "line": 4, + "line": 15, }, "start": Object { - "column": 50, - "line": 3, + "column": 17, + "line": 14, }, }, "range": Array [ - 70, - 75, + 368, + 373, ], "type": "JSXText", "value": " @@ -5101,16 +6739,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 4, + "line": 15, }, "start": Object { "column": 4, - "line": 4, + "line": 15, }, }, "range": Array [ - 75, - 76, + 373, + 374, ], "type": "Punctuator", "value": "<", @@ -5119,16 +6757,16 @@ Object { "loc": Object { "end": Object { "column": 14, - "line": 4, + "line": 15, }, "start": Object { "column": 5, - "line": 4, + "line": 15, }, }, "range": Array [ - 76, - 85, + 374, + 383, ], "type": "JSXIdentifier", "value": "Component", @@ -5137,16 +6775,16 @@ Object { "loc": Object { "end": Object { "column": 15, - "line": 4, + "line": 15, }, "start": Object { "column": 14, - "line": 4, + "line": 15, }, }, "range": Array [ - 85, - 86, + 383, + 384, ], "type": "Punctuator", "value": "<", @@ -5155,16 +6793,16 @@ Object { "loc": Object { "end": Object { "column": 21, - "line": 4, + "line": 15, }, "start": Object { "column": 15, - "line": 4, + "line": 15, }, }, "range": Array [ - 86, - 92, + 384, + 390, ], "type": "Identifier", "value": "number", @@ -5173,16 +6811,16 @@ Object { "loc": Object { "end": Object { "column": 22, - "line": 4, + "line": 15, }, "start": Object { "column": 21, - "line": 4, + "line": 15, }, }, "range": Array [ - 92, - 93, + 390, + 391, ], "type": "Punctuator", "value": ">", @@ -5190,17 +6828,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 9, + "line": 17, }, "start": Object { - "column": 23, - "line": 4, + "column": 6, + "line": 17, }, }, "range": Array [ - 94, - 97, + 416, + 419, ], "type": "JSXIdentifier", "value": "foo", @@ -5208,17 +6846,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, - "line": 4, + "column": 5, + "line": 18, }, "start": Object { - "column": 41, - "line": 4, + "column": 4, + "line": 18, }, }, "range": Array [ - 112, - 113, + 424, + 425, ], "type": "Punctuator", "value": ">", @@ -5226,17 +6864,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, - "line": 4, + "column": 6, + "line": 18, }, "start": Object { - "column": 42, - "line": 4, + "column": 5, + "line": 18, }, }, "range": Array [ - 113, - 114, + 425, + 426, ], "type": "Punctuator", "value": "<", @@ -5244,17 +6882,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, - "line": 4, + "column": 7, + "line": 18, }, "start": Object { - "column": 43, - "line": 4, + "column": 6, + "line": 18, }, }, "range": Array [ - 114, - 115, + 426, + 427, ], "type": "Punctuator", "value": "/", @@ -5262,17 +6900,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 53, - "line": 4, + "column": 16, + "line": 18, }, "start": Object { - "column": 44, - "line": 4, + "column": 7, + "line": 18, }, }, "range": Array [ - 115, - 124, + 427, + 436, ], "type": "JSXIdentifier", "value": "Component", @@ -5280,17 +6918,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 54, - "line": 4, + "column": 17, + "line": 18, }, "start": Object { - "column": 53, - "line": 4, + "column": 16, + "line": 18, }, }, "range": Array [ - 124, - 125, + 436, + 437, ], "type": "Punctuator", "value": ">", @@ -5299,16 +6937,16 @@ Object { "loc": Object { "end": Object { "column": 4, - "line": 5, + "line": 19, }, "start": Object { - "column": 54, - "line": 4, + "column": 17, + "line": 18, }, }, "range": Array [ - 125, - 130, + 437, + 442, ], "type": "JSXText", "value": " @@ -5318,16 +6956,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 5, + "line": 19, }, "start": Object { "column": 4, - "line": 5, + "line": 19, }, }, "range": Array [ - 130, - 131, + 442, + 443, ], "type": "Punctuator", "value": "<", @@ -5336,16 +6974,16 @@ Object { "loc": Object { "end": Object { "column": 14, - "line": 5, + "line": 19, }, "start": Object { "column": 5, - "line": 5, + "line": 19, }, }, "range": Array [ - 131, - 140, + 443, + 452, ], "type": "JSXIdentifier", "value": "Component", @@ -5354,16 +6992,16 @@ Object { "loc": Object { "end": Object { "column": 15, - "line": 5, + "line": 19, }, "start": Object { "column": 14, - "line": 5, + "line": 19, }, }, "range": Array [ - 140, - 141, + 452, + 453, ], "type": "Punctuator", "value": "<", @@ -5372,16 +7010,16 @@ Object { "loc": Object { "end": Object { "column": 21, - "line": 5, + "line": 19, }, "start": Object { "column": 15, - "line": 5, + "line": 19, }, }, "range": Array [ - 141, - 147, + 453, + 459, ], "type": "Identifier", "value": "number", @@ -5390,16 +7028,16 @@ Object { "loc": Object { "end": Object { "column": 22, - "line": 5, + "line": 19, }, "start": Object { "column": 21, - "line": 5, + "line": 19, }, }, "range": Array [ - 147, - 148, + 459, + 460, ], "type": "Punctuator", "value": ">", @@ -5407,17 +7045,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, - "line": 5, + "column": 9, + "line": 20, }, "start": Object { - "column": 38, - "line": 5, + "column": 6, + "line": 20, }, }, "range": Array [ - 164, - 167, + 467, + 470, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 22, + }, + "start": Object { + "column": 6, + "line": 22, + }, + }, + "range": Array [ + 495, + 498, ], "type": "JSXIdentifier", "value": "bar", @@ -5425,17 +7081,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, - "line": 5, + "column": 5, + "line": 23, }, "start": Object { - "column": 41, - "line": 5, + "column": 4, + "line": 23, }, }, "range": Array [ - 167, - 168, + 503, + 504, ], "type": "Punctuator", "value": ">", @@ -5443,17 +7099,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, - "line": 5, + "column": 6, + "line": 23, }, "start": Object { - "column": 42, - "line": 5, + "column": 5, + "line": 23, }, }, "range": Array [ - 168, - 169, + 504, + 505, ], "type": "Punctuator", "value": "<", @@ -5461,17 +7117,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, - "line": 5, + "column": 7, + "line": 23, }, "start": Object { - "column": 43, - "line": 5, + "column": 6, + "line": 23, }, }, "range": Array [ - 169, - 170, + 505, + 506, ], "type": "Punctuator", "value": "/", @@ -5479,17 +7135,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 53, - "line": 5, + "column": 16, + "line": 23, }, "start": Object { - "column": 44, - "line": 5, + "column": 7, + "line": 23, }, }, "range": Array [ - 170, - 179, + 506, + 515, ], "type": "JSXIdentifier", "value": "Component", @@ -5497,17 +7153,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 54, - "line": 5, + "column": 17, + "line": 23, }, "start": Object { - "column": 53, - "line": 5, + "column": 16, + "line": 23, }, }, "range": Array [ - 179, - 180, + 515, + 516, ], "type": "Punctuator", "value": ">", @@ -5515,905 +7171,1194 @@ Object { Object { "loc": Object { "end": Object { - "column": 4, - "line": 6, + "column": 2, + "line": 24, }, "start": Object { - "column": 54, - "line": 5, + "column": 17, + "line": 23, }, }, "range": Array [ - 180, - 185, + 516, + 519, ], "type": "JSXText", "value": " - ", + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 24, + }, + "start": Object { + "column": 2, + "line": 24, + }, + }, + "range": Array [ + 519, + 520, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 24, + }, + "start": Object { + "column": 3, + "line": 24, + }, + }, + "range": Array [ + 520, + 521, + ], + "type": "Punctuator", + "value": "/", }, Object { "loc": Object { "end": Object { "column": 5, - "line": 6, + "line": 24, }, "start": Object { "column": 4, - "line": 6, + "line": 24, }, }, "range": Array [ - 185, - 186, + 521, + 522, ], "type": "Punctuator", - "value": "<", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 6, + "column": 1, + "line": 25, }, "start": Object { - "column": 5, - "line": 6, + "column": 0, + "line": 25, }, }, "range": Array [ - 186, - 195, + 523, + 524, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 6, + "column": 2, + "line": 25, }, "start": Object { - "column": 14, - "line": 6, + "column": 1, + "line": 25, + }, + }, + "range": Array [ + 524, + 525, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/jsx-tag-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "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": "JSXText", + "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": 6, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 125, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 127, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 127, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 127, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 195, - 196, ], - "type": "Punctuator", - "value": "<", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 21, - "line": 6, + "column": 1, + "line": 9, }, "start": Object { - "column": 15, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 196, - 202, + 0, + 127, ], - "type": "Identifier", - "value": "number", + "type": "VariableDeclaration", }, + ], + "comments": Array [ Object { "loc": Object { "end": Object { - "column": 22, - "line": 6, - }, - "start": Object { "column": 21, - "line": 6, - }, - }, - "range": Array [ - 202, - 203, - ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 6, - }, - "start": Object { - "column": 23, - "line": 6, - }, - }, - "range": Array [ - 204, - 207, - ], - "type": "JSXIdentifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 6, - }, - "start": Object { - "column": 42, - "line": 6, - }, - }, - "range": Array [ - 223, - 226, - ], - "type": "JSXIdentifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 6, - }, - "start": Object { - "column": 45, - "line": 6, - }, - }, - "range": Array [ - 226, - 227, - ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 6, - }, - "start": Object { - "column": 46, - "line": 6, - }, - }, - "range": Array [ - 227, - 228, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 6, - }, - "start": Object { - "column": 47, - "line": 6, - }, - }, - "range": Array [ - 228, - 229, - ], - "type": "Punctuator", - "value": "/", - }, - Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 6, + "line": 4, }, "start": Object { - "column": 48, - "line": 6, + "column": 12, + "line": 4, }, }, "range": Array [ - 229, - 238, + 59, + 68, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Line", + "value": " single", }, Object { "loc": Object { "end": Object { - "column": 58, - "line": 6, + "column": 23, + "line": 5, }, "start": Object { - "column": 57, - "line": 6, + "column": 12, + "line": 5, }, }, "range": Array [ - 238, - 239, + 81, + 92, ], - "type": "Punctuator", - "value": ">", + "type": "Block", + "value": " block ", }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 8, - }, - "start": Object { - "column": 58, - "line": 6, - }, - }, - "range": Array [ - 239, - 245, - ], - "type": "JSXText", - "value": " - - ", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 11, }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "range": Array [ - 245, - 246, - ], - "type": "Punctuator", - "value": "<", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 129, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 14, - "line": 8, - }, - "start": Object { "column": 5, - "line": 8, - }, - }, - "range": Array [ - 246, - 255, - ], - "type": "JSXIdentifier", - "value": "Component", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 8, - }, - "start": Object { - "column": 14, - "line": 8, - }, - }, - "range": Array [ - 255, - 256, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 8, + "line": 1, }, "start": Object { - "column": 15, - "line": 8, + "column": 0, + "line": 1, }, }, "range": Array [ - 256, - 262, + 0, + 5, ], - "type": "Identifier", - "value": "number", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 8, + "column": 10, + "line": 1, }, "start": Object { - "column": 21, - "line": 8, + "column": 6, + "line": 1, }, }, "range": Array [ - 262, - 263, + 6, + 10, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "pure", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 10, + "column": 12, + "line": 1, }, "start": Object { - "column": 4, - "line": 10, + "column": 11, + "line": 1, }, }, "range": Array [ - 286, - 287, + 11, + 12, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 10, + "column": 14, + "line": 1, }, "start": Object { - "column": 5, - "line": 10, + "column": 13, + "line": 1, }, }, "range": Array [ - 287, - 288, + 13, + 14, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 10, + "column": 15, + "line": 1, }, "start": Object { - "column": 6, - "line": 10, + "column": 14, + "line": 1, }, }, "range": Array [ - 288, - 289, + 14, + 15, ], "type": "Punctuator", - "value": "/", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 10, + "column": 18, + "line": 1, }, "start": Object { - "column": 7, - "line": 10, + "column": 16, + "line": 1, }, }, "range": Array [ - 289, - 298, + 16, + 18, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 10, + "column": 20, + "line": 1, }, "start": Object { - "column": 16, - "line": 10, + "column": 19, + "line": 1, }, }, "range": Array [ - 298, - 299, + 19, + 20, ], "type": "Punctuator", - "value": ">", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 11, + "column": 10, + "line": 2, }, "start": Object { - "column": 17, - "line": 10, + "column": 4, + "line": 2, }, }, "range": Array [ - 299, - 304, + 25, + 31, ], - "type": "JSXText", - "value": " - ", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 11, + "column": 12, + "line": 2, }, "start": Object { - "column": 4, - "line": 11, + "column": 11, + "line": 2, }, }, "range": Array [ - 304, - 305, + 32, + 33, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 11, + "column": 9, + "line": 3, }, "start": Object { - "column": 5, - "line": 11, + "column": 8, + "line": 3, }, }, "range": Array [ - 305, - 314, + 42, + 43, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 11, + "column": 12, + "line": 3, }, "start": Object { - "column": 14, - "line": 11, + "column": 9, + "line": 3, }, }, "range": Array [ - 314, - 315, + 43, + 46, ], - "type": "Punctuator", - "value": "<", + "type": "JSXIdentifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 11, + "column": 9, + "line": 6, }, "start": Object { - "column": 15, - "line": 11, + "column": 8, + "line": 6, }, }, "range": Array [ - 315, - 321, + 102, + 103, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 11, + "column": 8, + "line": 7, }, "start": Object { - "column": 21, - "line": 11, + "column": 9, + "line": 6, }, }, "range": Array [ - 321, - 322, + 103, + 112, ], - "type": "Punctuator", - "value": ">", + "type": "JSXText", + "value": " + ", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 12, + "line": 7, }, "start": Object { - "column": 6, - "line": 12, + "column": 8, + "line": 7, }, }, "range": Array [ - 329, - 332, + 112, + 113, ], - "type": "JSXIdentifier", - "value": "foo", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 14, + "column": 10, + "line": 7, }, "start": Object { - "column": 4, - "line": 14, + "column": 9, + "line": 7, }, }, "range": Array [ - 355, - 356, + 113, + 114, ], "type": "Punctuator", - "value": ">", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 14, + "column": 13, + "line": 7, }, "start": Object { - "column": 5, - "line": 14, + "column": 10, + "line": 7, }, }, "range": Array [ - 356, - 357, + 114, + 117, ], - "type": "Punctuator", - "value": "<", + "type": "JSXIdentifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 14, + "column": 14, + "line": 7, }, "start": Object { - "column": 6, - "line": 14, + "column": 13, + "line": 7, }, }, "range": Array [ - 357, - 358, + 117, + 118, ], "type": "Punctuator", - "value": "/", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 14, + "column": 5, + "line": 8, }, "start": Object { - "column": 7, - "line": 14, + "column": 4, + "line": 8, }, }, "range": Array [ - 358, - 367, + 123, + 124, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 14, + "column": 6, + "line": 8, }, "start": Object { - "column": 16, - "line": 14, + "column": 5, + "line": 8, }, }, "range": Array [ - 367, - 368, + 124, + 125, ], "type": "Punctuator", - "value": ">", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 15, + "column": 1, + "line": 9, }, "start": Object { - "column": 17, - "line": 14, + "column": 0, + "line": 9, }, }, "range": Array [ - 368, - 373, + 126, + 127, ], - "type": "JSXText", - "value": " - ", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/jsx-text-with-multiline-non-comment.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 15, - }, - "start": Object { - "column": 4, - "line": 15, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 41, + 80, + ], + "raw": " + /** + * test + */ + ", + "type": "JSXText", + "value": " + /** + * test + */ + ", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "Foo", + "range": Array [ + 82, + 85, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 80, + 86, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 37, + 40, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 36, + 41, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 36, + 86, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 91, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 93, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 93, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 93, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 373, - 374, ], - "type": "Punctuator", - "value": "<", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 14, - "line": 15, + "column": 1, + "line": 9, }, "start": Object { - "column": 5, - "line": 15, + "column": 0, + "line": 1, }, }, "range": Array [ - 374, - 383, + 0, + 93, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 94, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 15, - "line": 15, + "column": 5, + "line": 1, }, "start": Object { - "column": 14, - "line": 15, + "column": 0, + "line": 1, }, }, "range": Array [ - 383, - 384, + 0, + 5, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 15, + "column": 10, + "line": 1, }, "start": Object { - "column": 15, - "line": 15, + "column": 6, + "line": 1, }, }, "range": Array [ - 384, - 390, + 6, + 10, ], "type": "Identifier", - "value": "number", + "value": "pure", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 15, + "column": 12, + "line": 1, }, "start": Object { - "column": 21, - "line": 15, + "column": 11, + "line": 1, }, }, "range": Array [ - 390, - 391, + 11, + 12, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 17, + "column": 14, + "line": 1, }, "start": Object { - "column": 6, - "line": 17, + "column": 13, + "line": 1, }, }, "range": Array [ - 416, - 419, + 13, + 14, ], - "type": "JSXIdentifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 18, + "column": 15, + "line": 1, }, "start": Object { - "column": 4, - "line": 18, + "column": 14, + "line": 1, }, }, "range": Array [ - 424, - 425, + 14, + 15, ], "type": "Punctuator", - "value": ">", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 18, + "column": 18, + "line": 1, }, "start": Object { - "column": 5, - "line": 18, + "column": 16, + "line": 1, }, }, "range": Array [ - 425, - 426, + 16, + 18, ], "type": "Punctuator", - "value": "<", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 18, + "column": 20, + "line": 1, }, "start": Object { - "column": 6, - "line": 18, + "column": 19, + "line": 1, }, }, "range": Array [ - 426, - 427, + 19, + 20, ], "type": "Punctuator", - "value": "/", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 18, + "column": 8, + "line": 2, }, "start": Object { - "column": 7, - "line": 18, + "column": 2, + "line": 2, }, }, "range": Array [ - 427, - 436, + 23, + 29, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 18, + "column": 10, + "line": 2, }, "start": Object { - "column": 16, - "line": 18, + "column": 9, + "line": 2, }, }, "range": Array [ - 436, - 437, + 30, + 31, ], "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 19, - }, - "start": Object { - "column": 17, - "line": 18, - }, - }, - "range": Array [ - 437, - 442, - ], - "type": "JSXText", - "value": " - ", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 5, - "line": 19, + "line": 3, }, "start": Object { "column": 4, - "line": 19, + "line": 3, }, }, "range": Array [ - 442, - 443, + 36, + 37, ], "type": "Punctuator", "value": "<", @@ -6421,125 +8366,129 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 19, + "column": 8, + "line": 3, }, "start": Object { "column": 5, - "line": 19, + "line": 3, }, }, "range": Array [ - 443, - 452, + 37, + 40, ], "type": "JSXIdentifier", - "value": "Component", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 19, + "column": 9, + "line": 3, }, "start": Object { - "column": 14, - "line": 19, + "column": 8, + "line": 3, }, }, "range": Array [ - 452, - 453, + 40, + 41, ], "type": "Punctuator", - "value": "<", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 19, + "column": 4, + "line": 7, }, "start": Object { - "column": 15, - "line": 19, + "column": 9, + "line": 3, }, }, "range": Array [ - 453, - 459, - ], - "type": "Identifier", - "value": "number", + 41, + 80, + ], + "type": "JSXText", + "value": " + /** + * test + */ + ", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 19, + "column": 5, + "line": 7, }, "start": Object { - "column": 21, - "line": 19, + "column": 4, + "line": 7, }, }, "range": Array [ - 459, - 460, + 80, + 81, ], "type": "Punctuator", - "value": ">", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 20, + "column": 6, + "line": 7, }, "start": Object { - "column": 6, - "line": 20, + "column": 5, + "line": 7, }, }, "range": Array [ - 467, - 470, + 81, + 82, ], - "type": "JSXIdentifier", - "value": "foo", + "type": "Punctuator", + "value": "/", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 22, + "line": 7, }, "start": Object { "column": 6, - "line": 22, + "line": 7, }, }, "range": Array [ - 495, - 498, + 82, + 85, ], "type": "JSXIdentifier", - "value": "bar", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 23, + "column": 10, + "line": 7, }, "start": Object { - "column": 4, - "line": 23, + "column": 9, + "line": 7, }, }, "range": Array [ - 503, - 504, + 85, + 86, ], "type": "Punctuator", "value": ">", @@ -6547,396 +8496,1011 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, - "line": 23, + "column": 3, + "line": 8, }, "start": Object { - "column": 5, - "line": 23, + "column": 2, + "line": 8, }, }, "range": Array [ - 504, - 505, + 89, + 90, ], "type": "Punctuator", - "value": "<", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 23, + "column": 4, + "line": 8, }, "start": Object { - "column": 6, - "line": 23, + "column": 3, + "line": 8, }, }, "range": Array [ - 505, - 506, + 90, + 91, ], "type": "Punctuator", - "value": "/", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 23, + "column": 1, + "line": 9, }, "start": Object { - "column": 7, - "line": 23, + "column": 0, + "line": 9, }, }, "range": Array [ - 506, - 515, + 92, + 93, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/jsx-text-with-url.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 23, - }, - "start": Object { - "column": 16, - "line": 23, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "first", + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 37, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 37, + 43, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "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 [ + 14, + 19, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 14, + 43, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 43, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 515, - 516, ], - "type": "Punctuator", - "value": ">", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 2, - "line": 24, + "column": 44, + "line": 1, }, "start": Object { - "column": 17, - "line": 23, + "column": 0, + "line": 1, }, }, "range": Array [ - 516, - 519, + 0, + 44, ], - "type": "JSXText", - "value": " - ", + "type": "VariableDeclaration", }, Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "second", + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 63, + 81, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingFragment": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "range": Array [ + 81, + 84, + ], + "type": "JSXClosingFragment", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "openingFragment": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "JSXOpeningFragment", + }, + "range": Array [ + 61, + 84, + ], + "type": "JSXFragment", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 52, + 84, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 3, - "line": 24, + "column": 39, + "line": 3, }, "start": Object { - "column": 2, - "line": 24, + "column": 0, + "line": 3, }, }, "range": Array [ - 519, - 520, + 46, + 85, ], - "type": "Punctuator", - "value": "<", + "type": "VariableDeclaration", }, Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 24, - }, - "start": Object { - "column": 3, - "line": 24, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "third", + "range": Array [ + 93, + 98, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [ + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "name": "br", + "range": Array [ + 107, + 109, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 106, + 112, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 106, + 112, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 5, + }, + "start": Object { + "column": 25, + "line": 5, + }, + }, + "range": Array [ + 112, + 130, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 43, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "name": "div", + "range": Array [ + 132, + 135, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 130, + 136, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "name": "div", + "range": Array [ + 102, + 105, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 101, + 106, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 101, + 136, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 93, + 136, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 520, - 521, ], - "type": "Punctuator", - "value": "/", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 5, - "line": 24, + "column": 50, + "line": 5, }, "start": Object { - "column": 4, - "line": 24, + "column": 0, + "line": 5, }, }, "range": Array [ - 521, - 522, + 87, + 137, ], - "type": "Punctuator", - "value": ">", + "type": "VariableDeclaration", }, Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 25, - }, - "start": Object { - "column": 0, - "line": 25, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "fourth", + "range": Array [ + 145, + 151, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [ + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 28, + "line": 7, + }, + }, + "name": "span", + "range": Array [ + 167, + 171, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 165, + 172, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 7, + }, + "start": Object { + "column": 21, + "line": 7, + }, + }, + "name": "span", + "range": Array [ + 160, + 164, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 159, + 165, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 159, + 172, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 7, + }, + "start": Object { + "column": 33, + "line": 7, + }, + }, + "range": Array [ + 172, + 190, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 7, + }, + "start": Object { + "column": 51, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 7, + }, + "start": Object { + "column": 53, + "line": 7, + }, + }, + "name": "div", + "range": Array [ + 192, + 195, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 190, + 196, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "name": "div", + "range": Array [ + 155, + 158, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 154, + 159, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 154, + 196, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 145, + 196, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 523, - 524, ], - "type": "Punctuator", - "value": ")", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 2, - "line": 25, + "column": 58, + "line": 7, }, "start": Object { - "column": 1, - "line": 25, + "column": 0, + "line": 7, }, }, "range": Array [ - 524, - 525, + 139, + 197, ], - "type": "Punctuator", - "value": ";", + "type": "VariableDeclaration", }, - ], - "type": "Program", -} -`; - -exports[`Comments fixtures/jsx-tag-comments.src 1`] = ` -Object { - "body": Array [ Object { "declarations": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 11, + "line": 9, }, "start": Object { "column": 6, - "line": 1, + "line": 9, }, }, - "name": "pure", + "name": "fifth", "range": Array [ - 6, - 10, + 205, + 210, ], "type": "Identifier", }, "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": "JSXText", - "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", - }, + "children": Array [ + Object { + "expression": Object { "loc": Object { "end": Object { - "column": 6, - "line": 8, + "column": 20, + "line": 9, }, "start": Object { - "column": 4, - "line": 2, + "column": 20, + "line": 9, }, }, "range": Array [ - 25, - 125, + 219, + 219, ], - "type": "ReturnStatement", + "type": "JSXEmptyExpression", }, - ], + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 218, + 220, + ], + "type": "JSXExpressionContainer", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 9, + }, + "start": Object { + "column": 21, + "line": 9, + }, + }, + "range": Array [ + 220, + 238, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingElement": Object { "loc": Object { "end": Object { - "column": 1, + "column": 45, "line": 9, }, "start": Object { + "column": 39, + "line": 9, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 9, + }, + "start": Object { + "column": 41, + "line": 9, + }, + }, + "name": "div", + "range": Array [ + 240, + 243, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 238, + 244, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { "column": 19, - "line": 1, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, }, + "name": "div", + "range": Array [ + 214, + 217, + ], + "type": "JSXIdentifier", }, "range": Array [ - 19, - 127, + 213, + 218, ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "selfClosing": false, + "type": "JSXOpeningElement", }, - "params": Array [], "range": Array [ - 13, - 127, + 213, + 244, ], - "type": "ArrowFunctionExpression", + "type": "JSXElement", }, "loc": Object { "end": Object { - "column": 1, + "column": 45, "line": 9, }, "start": Object { "column": 6, - "line": 1, + "line": 9, }, }, "range": Array [ - 6, - 127, + 205, + 244, ], "type": "VariableDeclarator", }, @@ -6944,378 +9508,538 @@ Object { "kind": "const", "loc": Object { "end": Object { - "column": 1, + "column": 46, "line": 9, }, "start": Object { "column": 0, - "line": 1, + "line": 9, }, }, "range": Array [ - 0, - 127, + 199, + 245, ], "type": "VariableDeclaration", }, ], - "comments": Array [ + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 246, + ], + "sourceType": "module", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 21, - "line": 4, + "column": 5, + "line": 1, }, "start": Object { - "column": 12, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 59, - 68, + 0, + 5, ], - "type": "Line", - "value": " single", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 5, + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "value": "first", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, }, "start": Object { "column": 12, - "line": 5, + "line": 1, }, }, "range": Array [ - 81, - 92, + 12, + 13, ], - "type": "Block", - "value": " block ", + "type": "Punctuator", + "value": "=", }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 11, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", }, - "start": Object { - "column": 0, - "line": 1, + 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": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 37, + ], + "type": "JSXText", + "value": "http://example.com", + }, + 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": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ">", }, - }, - "range": Array [ - 0, - 129, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 44, "line": 1, }, "start": Object { - "column": 0, + "column": 43, "line": 1, }, }, "range": Array [ - 0, - 5, + 43, + 44, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 6, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 6, - 10, + 46, + 51, ], - "type": "Identifier", - "value": "pure", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { "column": 12, - "line": 1, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 6, + "line": 3, }, }, "range": Array [ - 11, - 12, + 52, + 58, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "second", }, Object { "loc": Object { "end": Object { "column": 14, - "line": 1, + "line": 3, }, "start": Object { "column": 13, - "line": 1, + "line": 3, }, }, "range": Array [ - 13, - 14, + 59, + 60, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 16, + "line": 3, }, "start": Object { - "column": 14, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ - 14, - 15, + 61, + 62, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 17, + "line": 3, }, "start": Object { "column": 16, - "line": 1, + "line": 3, }, }, "range": Array [ - 16, - 18, + 62, + 63, ], "type": "Punctuator", - "value": "=>", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 35, + "line": 3, }, "start": Object { - "column": 19, - "line": 1, + "column": 17, + "line": 3, }, }, "range": Array [ - 19, - 20, + 63, + 81, ], - "type": "Punctuator", - "value": "{", + "type": "JSXText", + "value": "http://example.com", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 36, + "line": 3, }, "start": Object { - "column": 4, - "line": 2, + "column": 35, + "line": 3, }, }, "range": Array [ - 25, - 31, + 81, + 82, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 37, + "line": 3, }, "start": Object { - "column": 11, - "line": 2, + "column": 36, + "line": 3, }, }, "range": Array [ - 32, - 33, + 82, + 83, ], "type": "Punctuator", - "value": "(", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 38, "line": 3, }, "start": Object { - "column": 8, + "column": 37, "line": 3, }, }, "range": Array [ - 42, - 43, + 83, + 84, ], "type": "Punctuator", - "value": "<", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 39, "line": 3, }, "start": Object { - "column": 9, + "column": 38, "line": 3, }, }, "range": Array [ - 43, - 46, + 84, + 85, ], - "type": "JSXIdentifier", - "value": "Foo", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 6, + "column": 5, + "line": 5, }, "start": Object { - "column": 8, - "line": 6, + "column": 0, + "line": 5, }, }, "range": Array [ - 102, - 103, + 87, + 92, ], - "type": "Punctuator", - "value": ">", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 7, + "column": 11, + "line": 5, }, "start": Object { - "column": 9, - "line": 6, + "column": 6, + "line": 5, }, }, "range": Array [ - 103, - 112, + 93, + 98, ], - "type": "JSXText", - "value": " - ", + "type": "Identifier", + "value": "third", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 7, + "column": 13, + "line": 5, }, "start": Object { - "column": 8, - "line": 7, + "column": 12, + "line": 5, }, }, "range": Array [ - 112, - 113, + 99, + 100, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 7, + "column": 15, + "line": 5, }, "start": Object { - "column": 9, - "line": 7, + "column": 14, + "line": 5, }, }, "range": Array [ - 113, - 114, + 101, + 102, ], "type": "Punctuator", - "value": "/", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 7, + "column": 18, + "line": 5, }, "start": Object { - "column": 10, - "line": 7, + "column": 15, + "line": 5, }, }, "range": Array [ - 114, - 117, + 102, + 105, ], "type": "JSXIdentifier", - "value": "Foo", + "value": "div", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 7, + "column": 19, + "line": 5, }, "start": Object { - "column": 13, - "line": 7, + "column": 18, + "line": 5, }, }, "range": Array [ - 117, - 118, + 105, + 106, ], "type": "Punctuator", "value": ">", @@ -7323,566 +10047,359 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 8, + "column": 20, + "line": 5, }, "start": Object { - "column": 4, - "line": 8, + "column": 19, + "line": 5, }, }, "range": Array [ - 123, - 124, + 106, + 107, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 107, + 109, ], - "type": "Punctuator", - "value": ")", + "type": "JSXIdentifier", + "value": "br", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 8, + "column": 24, + "line": 5, }, "start": Object { - "column": 5, - "line": 8, + "column": 23, + "line": 5, }, }, "range": Array [ - 124, - 125, + 110, + 111, ], "type": "Punctuator", - "value": ";", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 25, + "line": 5, }, "start": Object { - "column": 0, - "line": 9, + "column": 24, + "line": 5, }, }, "range": Array [ - 126, - 127, + 111, + 112, ], "type": "Punctuator", - "value": "}", + "value": ">", }, - ], - "type": "Program", -} -`; - -exports[`Comments fixtures/jsx-text-with-multiline-non-comment.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "pure", - "range": Array [ - 6, - 10, - ], - "type": "Identifier", - }, - "init": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "children": Array [ - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 7, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "range": Array [ - 41, - 80, - ], - "raw": " - /** - * test - */ - ", - "type": "JSXText", - "value": " - /** - * test - */ - ", - }, - ], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 7, - }, - "start": Object { - "column": 6, - "line": 7, - }, - }, - "name": "Foo", - "range": Array [ - 82, - 85, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 80, - 86, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 10, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "openingElement": Object { - "attributes": Array [], - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "Foo", - "range": Array [ - 37, - 40, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 36, - 41, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - }, - "range": Array [ - 36, - 86, - ], - "type": "JSXElement", - }, - "loc": Object { - "end": Object { - "column": 4, - "line": 8, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 23, - 91, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 93, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 13, - 93, - ], - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 93, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 43, + "line": 5, }, + "start": Object { + "column": 25, + "line": 5, + }, + }, + "range": Array [ + 112, + 130, ], - "kind": "const", + "type": "JSXText", + "value": "http://example.com", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 44, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 43, + "line": 5, }, }, "range": Array [ - 0, - 93, + 130, + 131, ], - "type": "VariableDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 10, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "<", }, - }, - "range": Array [ - 0, - 94, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 45, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 44, + "line": 5, }, }, "range": Array [ - 0, - 5, + 131, + 132, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 48, + "line": 5, }, "start": Object { - "column": 6, - "line": 1, + "column": 45, + "line": 5, }, }, "range": Array [ - 6, - 10, + 132, + 135, ], - "type": "Identifier", - "value": "pure", + "type": "JSXIdentifier", + "value": "div", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 49, + "line": 5, }, "start": Object { - "column": 11, - "line": 1, + "column": 48, + "line": 5, }, }, "range": Array [ - 11, - 12, + 135, + 136, ], "type": "Punctuator", - "value": "=", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 50, + "line": 5, }, "start": Object { - "column": 13, - "line": 1, + "column": 49, + "line": 5, }, }, "range": Array [ - 13, - 14, + 136, + 137, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 5, + "line": 7, }, "start": Object { - "column": 14, - "line": 1, + "column": 0, + "line": 7, }, }, "range": Array [ - 14, - 15, + 139, + 144, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 12, + "line": 7, }, "start": Object { - "column": 16, - "line": 1, + "column": 6, + "line": 7, }, }, "range": Array [ - 16, - 18, + 145, + 151, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "fourth", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 14, + "line": 7, }, "start": Object { - "column": 19, - "line": 1, + "column": 13, + "line": 7, }, }, "range": Array [ - 19, - 20, + 152, + 153, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 16, + "line": 7, }, "start": Object { - "column": 2, - "line": 2, + "column": 15, + "line": 7, }, }, "range": Array [ - 23, - 29, + 154, + 155, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 19, + "line": 7, }, "start": Object { - "column": 9, - "line": 2, + "column": 16, + "line": 7, }, }, "range": Array [ - 30, - 31, + 155, + 158, ], - "type": "Punctuator", - "value": "(", + "type": "JSXIdentifier", + "value": "div", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 20, + "line": 7, }, "start": Object { - "column": 4, - "line": 3, + "column": 19, + "line": 7, }, }, "range": Array [ - 36, - 37, + 158, + 159, ], "type": "Punctuator", - "value": "<", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 21, + "line": 7, }, "start": Object { - "column": 5, - "line": 3, + "column": 20, + "line": 7, }, }, "range": Array [ - 37, - 40, + 159, + 160, ], - "type": "JSXIdentifier", - "value": "Foo", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 25, + "line": 7, }, "start": Object { - "column": 8, - "line": 3, + "column": 21, + "line": 7, }, }, "range": Array [ - 40, - 41, + 160, + 164, ], - "type": "Punctuator", - "value": ">", + "type": "JSXIdentifier", + "value": "span", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 26, "line": 7, }, "start": Object { - "column": 9, - "line": 3, + "column": 25, + "line": 7, }, }, "range": Array [ - 41, - 80, + 164, + 165, ], - "type": "JSXText", - "value": " - /** - * test - */ - ", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 27, "line": 7, }, "start": Object { - "column": 4, + "column": 26, "line": 7, }, }, "range": Array [ - 80, - 81, + 165, + 166, ], "type": "Punctuator", "value": "<", @@ -7890,17 +10407,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 28, "line": 7, }, "start": Object { - "column": 5, + "column": 27, "line": 7, }, }, "range": Array [ - 81, - 82, + 166, + 167, ], "type": "Punctuator", "value": "/", @@ -7908,35 +10425,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 32, "line": 7, }, "start": Object { - "column": 6, + "column": 28, "line": 7, }, }, "range": Array [ - 82, - 85, + 167, + 171, ], "type": "JSXIdentifier", - "value": "Foo", + "value": "span", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 33, "line": 7, }, "start": Object { - "column": 9, + "column": 32, "line": 7, }, }, "range": Array [ - 85, - 86, + 171, + 172, ], "type": "Punctuator", "value": ">", @@ -7944,497 +10461,269 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 8, + "column": 51, + "line": 7, }, "start": Object { - "column": 2, - "line": 8, + "column": 33, + "line": 7, }, }, "range": Array [ - 89, - 90, + 172, + 190, ], - "type": "Punctuator", - "value": ")", + "type": "JSXText", + "value": "http://example.com", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 8, + "column": 52, + "line": 7, }, "start": Object { - "column": 3, - "line": 8, + "column": 51, + "line": 7, }, }, "range": Array [ - 90, - 91, + 190, + 191, ], "type": "Punctuator", - "value": ";", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 53, + "line": 7, }, "start": Object { - "column": 0, - "line": 9, + "column": 52, + "line": 7, }, }, "range": Array [ - 92, - 93, + 191, + 192, ], "type": "Punctuator", - "value": "}", + "value": "/", }, - ], - "type": "Program", -} -`; - -exports[`Comments fixtures/jsx-text-with-url.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "link", - "range": Array [ - 6, - 10, - ], - "type": "Identifier", - }, - "init": Object { - "children": Array [ - Object { - "loc": Object { - "end": Object { - "column": 61, - "line": 1, - }, - "start": Object { - "column": 43, - "line": 1, - }, - }, - "range": Array [ - 43, - 61, - ], - "raw": "http://example.com", - "type": "JSXText", - "value": "http://example.com", - }, - ], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 65, - "line": 1, - }, - "start": Object { - "column": 61, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 64, - "line": 1, - }, - "start": Object { - "column": 63, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 63, - 64, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 61, - 65, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 65, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "openingElement": Object { - "attributes": Array [ - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "href", - "range": Array [ - 17, - 21, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 17, - 42, - ], - "type": "JSXAttribute", - "value": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 42, - ], - "raw": "\\"http://example.com\\"", - "type": "Literal", - "value": "http://example.com", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 16, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 14, - 43, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - }, - "range": Array [ - 14, - 65, - ], - "type": "JSXElement", - }, - "loc": Object { - "end": Object { - "column": 66, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 66, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", "loc": Object { "end": Object { - "column": 67, - "line": 1, + "column": 56, + "line": 7, }, "start": Object { - "column": 0, - "line": 1, + "column": 53, + "line": 7, }, }, "range": Array [ - 0, - 67, + 192, + 195, ], - "type": "VariableDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "JSXIdentifier", + "value": "div", }, - }, - "range": Array [ - 0, - 68, - ], - "sourceType": "module", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 57, + "line": 7, }, "start": Object { - "column": 0, - "line": 1, + "column": 56, + "line": 7, }, }, "range": Array [ - 0, - 5, + 195, + 196, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 58, + "line": 7, }, "start": Object { - "column": 6, - "line": 1, + "column": 57, + "line": 7, }, }, "range": Array [ - 6, - 10, + 196, + 197, ], - "type": "Identifier", - "value": "link", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 5, + "line": 9, }, "start": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 9, }, }, "range": Array [ - 11, - 12, + 199, + 204, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 11, + "line": 9, }, "start": Object { - "column": 13, - "line": 1, + "column": 6, + "line": 9, }, }, "range": Array [ - 13, - 14, + 205, + 210, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "fifth", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 13, + "line": 9, }, "start": Object { - "column": 14, - "line": 1, + "column": 12, + "line": 9, }, }, "range": Array [ - 14, - 15, + 211, + 212, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 15, + "line": 9, }, "start": Object { - "column": 15, - "line": 1, + "column": 14, + "line": 9, }, }, "range": Array [ - 15, - 16, + 213, + 214, ], - "type": "JSXIdentifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 18, + "line": 9, }, "start": Object { - "column": 17, - "line": 1, + "column": 15, + "line": 9, }, }, "range": Array [ - 17, - 21, + 214, + 217, ], "type": "JSXIdentifier", - "value": "href", + "value": "div", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 19, + "line": 9, }, "start": Object { - "column": 21, - "line": 1, + "column": 18, + "line": 9, }, }, "range": Array [ - 21, - 22, + 217, + 218, ], "type": "Punctuator", - "value": "=", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 20, + "line": 9, }, "start": Object { - "column": 22, - "line": 1, + "column": 19, + "line": 9, }, }, "range": Array [ - 22, - 42, + 218, + 219, ], - "type": "JSXText", - "value": "\\"http://example.com\\"", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 21, + "line": 9, }, "start": Object { - "column": 42, - "line": 1, + "column": 20, + "line": 9, }, }, "range": Array [ - 42, - 43, + 219, + 220, ], "type": "Punctuator", - "value": ">", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 61, - "line": 1, + "column": 39, + "line": 9, }, "start": Object { - "column": 43, - "line": 1, + "column": 21, + "line": 9, }, }, "range": Array [ - 43, - 61, + 220, + 238, ], "type": "JSXText", "value": "http://example.com", @@ -8442,17 +10731,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 62, - "line": 1, + "column": 40, + "line": 9, }, "start": Object { - "column": 61, - "line": 1, + "column": 39, + "line": 9, }, }, "range": Array [ - 61, - 62, + 238, + 239, ], "type": "Punctuator", "value": "<", @@ -8460,17 +10749,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 63, - "line": 1, + "column": 41, + "line": 9, }, "start": Object { - "column": 62, - "line": 1, + "column": 40, + "line": 9, }, }, "range": Array [ - 62, - 63, + 239, + 240, ], "type": "Punctuator", "value": "/", @@ -8478,35 +10767,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 64, - "line": 1, + "column": 44, + "line": 9, }, "start": Object { - "column": 63, - "line": 1, + "column": 41, + "line": 9, }, }, "range": Array [ - 63, - 64, + 240, + 243, ], "type": "JSXIdentifier", - "value": "a", + "value": "div", }, Object { "loc": Object { "end": Object { - "column": 65, - "line": 1, + "column": 45, + "line": 9, }, "start": Object { - "column": 64, - "line": 1, + "column": 44, + "line": 9, }, }, "range": Array [ - 64, - 65, + 243, + 244, ], "type": "Punctuator", "value": ">", @@ -8514,35 +10803,17 @@ Object { 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": 67, - "line": 1, + "column": 46, + "line": 9, }, "start": Object { - "column": 66, - "line": 1, + "column": 45, + "line": 9, }, }, "range": Array [ - 66, - 67, + 244, + 245, ], "type": "Punctuator", "value": ";", diff --git a/packages/parser/tsconfig.build.json b/packages/parser/tsconfig.build.json index 578d8230840..a94802fb081 100644 --- a/packages/parser/tsconfig.build.json +++ b/packages/parser/tsconfig.build.json @@ -4,5 +4,5 @@ "declaration": true, "outDir": "./dist" }, - "include": ["src", "typings"] + "include": ["src"] } diff --git a/packages/parser/tsconfig.json b/packages/parser/tsconfig.json index 58599d3d3ed..6f763b588b5 100644 --- a/packages/parser/tsconfig.json +++ b/packages/parser/tsconfig.json @@ -1,5 +1,5 @@ { "extends": "./tsconfig.build.json", - "include": ["src", "typings", "tests", "tools"], + "include": ["src", "tests", "tools"], "exclude": ["tests/fixtures"] } diff --git a/packages/parser/typings/eslint.d.ts b/packages/parser/typings/eslint.d.ts deleted file mode 100644 index 15a965cd48d..00000000000 --- a/packages/parser/typings/eslint.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -declare module 'eslint/lib/util/traverser' { - import { TSESTree } from '@typescript-eslint/experimental-utils'; - const traverser: { - traverse( - node: TSESTree.Node, - options: { - enter?: (node: TSESTree.Node, parent: TSESTree.Node) => void; - leave?: (node: TSESTree.Node, parent: TSESTree.Node) => void; - visitorKeys?: Record; - }, - ): void; - }; - export = traverser; -} diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index ac95d2ff45b..9cdeac70951 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) + + +### Bug Fixes + +* **typescript-estree:** fix more cases with double slash in JSX text ([#607](https://github.com/typescript-eslint/typescript-eslint/issues/607)) ([34cfa53](https://github.com/typescript-eslint/typescript-eslint/commit/34cfa53)) + + + + + ## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/fixtures/comments/jsx-attr-and-text-with-url.src.js b/packages/shared-fixtures/fixtures/comments/jsx-attr-and-text-with-url.src.js new file mode 100644 index 00000000000..ab57e8d95da --- /dev/null +++ b/packages/shared-fixtures/fixtures/comments/jsx-attr-and-text-with-url.src.js @@ -0,0 +1 @@ +const link = (http://example.com); diff --git a/packages/shared-fixtures/fixtures/comments/jsx-text-with-url.src.js b/packages/shared-fixtures/fixtures/comments/jsx-text-with-url.src.js index ab57e8d95da..a20de1676b9 100644 --- a/packages/shared-fixtures/fixtures/comments/jsx-text-with-url.src.js +++ b/packages/shared-fixtures/fixtures/comments/jsx-text-with-url.src.js @@ -1 +1,9 @@ -const link = (http://example.com); +const first =
http://example.com
; + +const second = <>http://example.com; + +const third =

http://example.com
; + +const fourth =
http://example.com
; + +const fifth =
{}http://example.com
; diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 3379c577ed2..28caabd65f4 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "1.10.2", + "version": "1.11.0", "private": true } diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index b94083bece0..4f3c7cd4956 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.11.0](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.2...v1.11.0) (2019-06-23) + + +### Bug Fixes + +* **typescript-estree:** fix more cases with double slash in JSX text ([#607](https://github.com/typescript-eslint/typescript-eslint/issues/607)) ([34cfa53](https://github.com/typescript-eslint/typescript-eslint/commit/34cfa53)) + + + + + ## [1.10.2](https://github.com/typescript-eslint/typescript-eslint/compare/v1.10.1...v1.10.2) (2019-06-10) **Note:** Version bump only for package @typescript-eslint/typescript-estree diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index 350333bdf63..61ccbddf858 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "1.10.2", + "version": "1.11.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/parser.js", "types": "dist/parser.d.ts", @@ -46,6 +46,6 @@ }, "devDependencies": { "@babel/types": "^7.3.2", - "@typescript-eslint/shared-fixtures": "1.10.2" + "@typescript-eslint/shared-fixtures": "1.11.0" } } diff --git a/packages/typescript-estree/src/convert-comments.ts b/packages/typescript-estree/src/convert-comments.ts index 15900403914..159c24cf3ef 100644 --- a/packages/typescript-estree/src/convert-comments.ts +++ b/packages/typescript-estree/src/convert-comments.ts @@ -118,13 +118,24 @@ export function convertComments( case ts.SyntaxKind.GreaterThanToken: container = getNodeContainer(ast, start, end); if ( - container && - container.parent && - container.parent.kind === ts.SyntaxKind.JsxOpeningElement && - // Make sure this is the end of the opening element and not type parameter - end === container.parent.end && - container.parent.parent && - container.parent.parent.kind === ts.SyntaxKind.JsxElement + (container.parent && + container.parent.parent && + // Rescan after an opening element or fragment + (container.parent.kind === ts.SyntaxKind.JsxOpeningElement && + // Make sure this is the end of a tag like `>` + container.parent.end === end)) || + container.parent.kind === ts.SyntaxKind.JsxOpeningFragment || + // Rescan after a self-closing element if it's inside another JSX element + (container.parent.kind === ts.SyntaxKind.JsxSelfClosingElement && + (container.parent.parent.kind === ts.SyntaxKind.JsxElement || + container.parent.parent.kind === ts.SyntaxKind.JsxFragment)) || + // Rescan after a closing element if it's inside another JSX element + ((container.parent.kind === ts.SyntaxKind.JsxClosingElement || + container.parent.kind === ts.SyntaxKind.JsxClosingFragment) && + container.parent.parent.parent && + (container.parent.parent.parent.kind === ts.SyntaxKind.JsxElement || + container.parent.parent.parent.kind === + ts.SyntaxKind.JsxFragment)) ) { kind = triviaScanner.reScanJsxToken(); continue; @@ -133,6 +144,15 @@ export function convertComments( case ts.SyntaxKind.CloseBraceToken: container = getNodeContainer(ast, start, end); + // Rescan after a JSX expression + if ( + container.parent && + container.parent.kind === ts.SyntaxKind.JsxExpression + ) { + kind = triviaScanner.reScanJsxToken(); + continue; + } + if ( container.kind === ts.SyntaxKind.TemplateMiddle || container.kind === ts.SyntaxKind.TemplateTail diff --git a/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap index ba119ad7aa5..e143fdb8524 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/comments.ts.snap @@ -1171,7 +1171,7 @@ Object { } `; -exports[`Comments fixtures/jsx-block-comment.src 1`] = ` +exports[`Comments fixtures/jsx-attr-and-text-with-url.src 1`] = ` Object { "body": Array [ Object { @@ -1188,7 +1188,7 @@ Object { "line": 1, }, }, - "name": "pure", + "name": "link", "range": Array [ 6, 10, @@ -1196,234 +1196,174 @@ Object { "type": "Identifier", }, "init": Object { - "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", + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, }, - "loc": Object { - "end": Object { - "column": 6, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 2, - }, + "start": Object { + "column": 43, + "line": 1, }, - "range": Array [ - 25, - 95, - ], - "type": "ReturnStatement", }, - ], + "range": Array [ + 43, + 61, + ], + "raw": "http://example.com", + "type": "Literal", + "value": "http://example.com", + }, + ], + "closingElement": Object { "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 65, + "line": 1, }, "start": Object { - "column": 19, + "column": 61, "line": 1, }, }, + "name": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 63, + 64, + ], + "type": "JSXIdentifier", + }, "range": Array [ - 19, - 97, + 61, + 65, ], - "type": "BlockStatement", + "type": "JSXClosingElement", }, - "expression": false, - "generator": false, - "id": null, "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 65, + "line": 1, }, "start": Object { - "column": 13, + "column": 14, "line": 1, }, }, - "params": Array [], - "range": Array [ - 13, - 97, - ], - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 7, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "href", + "range": Array [ + 17, + 21, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 17, + 42, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 42, + ], + "raw": "\\"http://example.com\\"", + "type": "Literal", + "value": "http://example.com", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 15, + 16, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 14, + 43, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 14, + 65, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 66, + "line": 1, }, "start": Object { "column": 6, @@ -1432,7 +1372,7 @@ Object { }, "range": Array [ 6, - 97, + 66, ], "type": "VariableDeclarator", }, @@ -1440,8 +1380,8 @@ Object { "kind": "const", "loc": Object { "end": Object { - "column": 1, - "line": 7, + "column": 67, + "line": 1, }, "start": Object { "column": 0, @@ -1450,35 +1390,16 @@ Object { }, "range": Array [ 0, - 97, + 67, ], "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", - }, - ], + "comments": Array [], "loc": Object { "end": Object { "column": 0, - "line": 8, + "line": 2, }, "start": Object { "column": 0, @@ -1487,7 +1408,7 @@ Object { }, "range": Array [ 0, - 98, + 68, ], "sourceType": "script", "tokens": Array [ @@ -1525,7 +1446,7 @@ Object { 10, ], "type": "Identifier", - "value": "pure", + "value": "link", }, Object { "loc": Object { @@ -1579,89 +1500,89 @@ Object { 15, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 18, + "column": 16, "line": 1, }, "start": Object { - "column": 16, + "column": 15, "line": 1, }, }, "range": Array [ + 15, 16, - 18, ], - "type": "Punctuator", - "value": "=>", + "type": "JSXIdentifier", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 20, + "column": 21, "line": 1, }, "start": Object { - "column": 19, + "column": 17, "line": 1, }, }, "range": Array [ - 19, - 20, + 17, + 21, ], - "type": "Punctuator", - "value": "{", + "type": "JSXIdentifier", + "value": "href", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 22, + "line": 1, }, "start": Object { - "column": 4, - "line": 2, + "column": 21, + "line": 1, }, }, "range": Array [ - 25, - 31, + 21, + 22, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 42, + "line": 1, }, "start": Object { - "column": 11, - "line": 2, + "column": 22, + "line": 1, }, }, "range": Array [ - 32, - 33, + 22, + 42, ], - "type": "Punctuator", - "value": "(", + "type": "JSXText", + "value": "\\"http://example.com\\"", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 43, + "line": 1, }, "start": Object { - "column": 8, - "line": 3, + "column": 42, + "line": 1, }, }, "range": Array [ @@ -1669,186 +1590,94 @@ Object { 43, ], "type": "Punctuator", - "value": "<", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 61, + "line": 1, }, "start": Object { - "column": 9, - "line": 3, + "column": 43, + "line": 1, }, }, "range": Array [ 43, - 46, + 61, ], - "type": "JSXIdentifier", - "value": "Foo", + "type": "JSXText", + "value": "http://example.com", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 3, + "column": 62, + "line": 1, }, "start": Object { - "column": 12, - "line": 3, + "column": 61, + "line": 1, }, }, "range": Array [ - 46, - 47, + 61, + 62, ], "type": "Punctuator", - "value": ">", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 4, + "column": 63, + "line": 1, }, "start": Object { - "column": 13, - "line": 3, + "column": 62, + "line": 1, }, }, "range": Array [ - 47, - 60, + 62, + 63, ], - "type": "JSXText", - "value": " - ", + "type": "Punctuator", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 4, + "column": 64, + "line": 1, }, "start": Object { - "column": 12, - "line": 4, - }, - }, - "range": Array [ - 60, - 61, - ], - "type": "Punctuator", - "value": "{", - }, - Object { - "loc": Object { - "end": Object { - "column": 25, - "line": 4, - }, - "start": Object { - "column": 24, - "line": 4, - }, - }, - "range": Array [ - 72, - 73, - ], - "type": "Punctuator", - "value": "}", - }, - Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 5, - }, - "start": Object { - "column": 25, - "line": 4, - }, - }, - "range": Array [ - 73, - 82, - ], - "type": "JSXText", - "value": " - ", - }, - 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, + "column": 63, + "line": 1, }, }, "range": Array [ - 84, - 87, + 63, + 64, ], "type": "JSXIdentifier", - "value": "Foo", + "value": "a", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 5, + "column": 65, + "line": 1, }, "start": Object { - "column": 13, - "line": 5, + "column": 64, + "line": 1, }, }, "range": Array [ - 87, - 88, + 64, + 65, ], "type": "Punctuator", "value": ">", @@ -1856,17 +1685,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 6, + "column": 66, + "line": 1, }, "start": Object { - "column": 4, - "line": 6, + "column": 65, + "line": 1, }, }, "range": Array [ - 93, - 94, + 65, + 66, ], "type": "Punctuator", "value": ")", @@ -1874,45 +1703,27 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, - "line": 6, + "column": 67, + "line": 1, }, "start": Object { - "column": 5, - "line": 6, + "column": 66, + "line": 1, }, }, "range": Array [ - 94, - 95, + 66, + 67, ], "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": "}", - }, ], "type": "Program", } `; -exports[`Comments fixtures/jsx-comment-after-jsx.src 1`] = ` +exports[`Comments fixtures/jsx-block-comment.src 1`] = ` Object { "body": Array [ Object { @@ -1942,99 +1753,176 @@ Object { "body": Array [ Object { "argument": Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 13, - "line": 3, - }, - }, - "name": Object { + "children": Array [ + Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 12, + "line": 4, }, "start": Object { - "column": 15, + "column": 13, "line": 3, }, }, - "name": "Foo", "range": Array [ - 49, - 52, + 47, + 60, ], - "type": "JSXIdentifier", - }, - "range": Array [ - 47, - 53, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 19, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, + "raw": " + ", + "type": "Literal", + "value": " + ", }, - }, - "openingElement": Object { - "attributes": Array [], - "loc": Object { - "end": Object { - "column": 13, - "line": 3, - }, - "start": Object { - "column": 8, - "line": 3, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 61, + 72, + ], + "type": "JSXEmptyExpression", }, - }, - "name": Object { "loc": Object { "end": Object { - "column": 12, - "line": 3, + "column": 25, + "line": 4, }, "start": Object { - "column": 9, - "line": 3, + "column": 12, + "line": 4, }, }, - "name": "Foo", "range": Array [ - 43, - 46, + 60, + 73, ], - "type": "JSXIdentifier", + "type": "JSXExpressionContainer", }, - "range": Array [ - 42, - 47, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - }, - "range": Array [ - 42, - 53, + 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", }, "loc": Object { "end": Object { "column": 6, - "line": 4, + "line": 6, }, "start": Object { "column": 4, @@ -2043,7 +1931,7 @@ Object { }, "range": Array [ 25, - 67, + 95, ], "type": "ReturnStatement", }, @@ -2051,7 +1939,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 7, }, "start": Object { "column": 19, @@ -2060,7 +1948,7 @@ Object { }, "range": Array [ 19, - 69, + 97, ], "type": "BlockStatement", }, @@ -2070,7 +1958,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 7, }, "start": Object { "column": 13, @@ -2080,14 +1968,14 @@ Object { "params": Array [], "range": Array [ 13, - 69, + 97, ], "type": "ArrowFunctionExpression", }, "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 7, }, "start": Object { "column": 6, @@ -2096,7 +1984,7 @@ Object { }, "range": Array [ 6, - 69, + 97, ], "type": "VariableDeclarator", }, @@ -2105,7 +1993,7 @@ Object { "loc": Object { "end": Object { "column": 1, - "line": 5, + "line": 7, }, "start": Object { "column": 0, @@ -2114,7 +2002,7 @@ Object { }, "range": Array [ 0, - 69, + 97, ], "type": "VariableDeclaration", }, @@ -2123,26 +2011,26 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 3, + "column": 24, + "line": 4, }, "start": Object { - "column": 20, - "line": 3, + "column": 13, + "line": 4, }, }, "range": Array [ - 54, - 60, + 61, + 72, ], - "type": "Line", - "value": " Foo", + "type": "Block", + "value": "COMMENT", }, ], "loc": Object { "end": Object { "column": 0, - "line": 6, + "line": 8, }, "start": Object { "column": 0, @@ -2151,7 +2039,7 @@ Object { }, "range": Array [ 0, - 70, + 98, ], "sourceType": "script", "tokens": Array [ @@ -2374,8 +2262,8 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 3, + "column": 12, + "line": 4, }, "start": Object { "column": 13, @@ -2384,131 +2272,205 @@ Object { }, "range": Array [ 47, - 48, + 60, ], - "type": "Punctuator", - "value": "<", + "type": "JSXText", + "value": " + ", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 3, + "column": 13, + "line": 4, }, "start": Object { - "column": 14, - "line": 3, + "column": 12, + "line": 4, }, }, "range": Array [ - 48, - 49, + 60, + 61, ], "type": "Punctuator", - "value": "/", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 4, }, "start": Object { - "column": 15, - "line": 3, + "column": 24, + "line": 4, }, }, "range": Array [ - 49, - 52, + 72, + 73, ], - "type": "JSXIdentifier", - "value": "Foo", + "type": "Punctuator", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 19, - "line": 3, + "column": 8, + "line": 5, }, "start": Object { - "column": 18, - "line": 3, + "column": 25, + "line": 4, }, }, "range": Array [ - 52, - 53, + 73, + 82, ], - "type": "Punctuator", - "value": ">", + "type": "JSXText", + "value": " + ", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 4, + "column": 9, + "line": 5, }, "start": Object { - "column": 4, - "line": 4, + "column": 8, + "line": 5, }, }, "range": Array [ - 65, - 66, + 82, + 83, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 4, + "column": 10, + "line": 5, }, "start": Object { - "column": 5, - "line": 4, + "column": 9, + "line": 5, }, }, "range": Array [ - 66, - 67, + 83, + 84, ], "type": "Punctuator", - "value": ";", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 1, + "column": 13, "line": 5, }, "start": Object { - "column": 0, + "column": 10, "line": 5, }, }, "range": Array [ - 68, - 69, + 84, + 87, ], - "type": "Punctuator", - "value": "}", + "type": "JSXIdentifier", + "value": "Foo", }, - ], - "type": "Program", -} -`; - -exports[`Comments fixtures/jsx-comment-after-self-closing-jsx.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": 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": "}", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/jsx-comment-after-jsx.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { "loc": Object { "end": Object { "column": 10, @@ -2533,10 +2495,44 @@ Object { Object { "argument": Object { "children": Array [], - "closingElement": null, + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 49, + 52, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 47, + 53, + ], + "type": "JSXClosingElement", + }, "loc": Object { "end": Object { - "column": 15, + "column": 19, "line": 3, }, "start": Object { @@ -2548,7 +2544,7 @@ Object { "attributes": Array [], "loc": Object { "end": Object { - "column": 15, + "column": 13, "line": 3, }, "start": Object { @@ -2576,14 +2572,14 @@ Object { }, "range": Array [ 42, - 49, + 47, ], - "selfClosing": true, + "selfClosing": false, "type": "JSXOpeningElement", }, "range": Array [ 42, - 49, + 53, ], "type": "JSXElement", }, @@ -2599,7 +2595,7 @@ Object { }, "range": Array [ 25, - 63, + 67, ], "type": "ReturnStatement", }, @@ -2616,7 +2612,7 @@ Object { }, "range": Array [ 19, - 65, + 69, ], "type": "BlockStatement", }, @@ -2636,7 +2632,7 @@ Object { "params": Array [], "range": Array [ 13, - 65, + 69, ], "type": "ArrowFunctionExpression", }, @@ -2652,7 +2648,7 @@ Object { }, "range": Array [ 6, - 65, + 69, ], "type": "VariableDeclarator", }, @@ -2670,7 +2666,7 @@ Object { }, "range": Array [ 0, - 65, + 69, ], "type": "VariableDeclaration", }, @@ -2679,17 +2675,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 22, + "column": 26, "line": 3, }, "start": Object { - "column": 16, + "column": 20, "line": 3, }, }, "range": Array [ - 50, - 56, + 54, + 60, ], "type": "Line", "value": " Foo", @@ -2707,7 +2703,7 @@ Object { }, "range": Array [ 0, - 66, + 70, ], "sourceType": "script", "tokens": Array [ @@ -2909,6 +2905,24 @@ Object { "type": "JSXIdentifier", "value": "Foo", }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ">", + }, Object { "loc": Object { "end": Object { @@ -2925,7 +2939,7 @@ Object { 48, ], "type": "Punctuator", - "value": "/", + "value": "<", }, Object { "loc": Object { @@ -2943,6 +2957,42 @@ Object { 49, ], "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", "value": ">", }, Object { @@ -2957,8 +3007,8 @@ Object { }, }, "range": Array [ - 61, - 62, + 65, + 66, ], "type": "Punctuator", "value": ")", @@ -2975,8 +3025,8 @@ Object { }, }, "range": Array [ - 62, - 63, + 66, + 67, ], "type": "Punctuator", "value": ";", @@ -2993,8 +3043,8 @@ Object { }, }, "range": Array [ - 64, - 65, + 68, + 69, ], "type": "Punctuator", "value": "}", @@ -3004,7 +3054,7 @@ Object { } `; -exports[`Comments fixtures/jsx-generic-with-comment-in-tag.src 1`] = ` +exports[`Comments fixtures/jsx-comment-after-self-closing-jsx.src 1`] = ` Object { "body": Array [ Object { @@ -3021,7 +3071,7 @@ Object { "line": 1, }, }, - "name": "comp", + "name": "pure", "range": Array [ 6, 10, @@ -3029,792 +3079,1294 @@ Object { "type": "Identifier", }, "init": Object { - "children": Array [ - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 2, - }, - }, - "range": Array [ - 19, - 24, - ], - "raw": " - ", - "type": "Literal", - "value": " - ", - }, - Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 50, - "line": 3, - }, - "start": Object { - "column": 38, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 49, - "line": 3, - }, - "start": Object { - "column": 40, - "line": 3, - }, - }, - "name": "Component", - "range": Array [ - 60, - 69, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 58, - 70, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 50, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "openingElement": Object { - "attributes": Array [], - "loc": Object { - "end": Object { - "column": 38, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "Component", - "range": Array [ - 25, - 34, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 24, - 58, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - "typeParameters": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [], + "closingElement": null, "loc": Object { "end": Object { - "column": 22, + "column": 15, "line": 3, }, "start": Object { - "column": 14, + "column": 8, "line": 3, }, }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 3, - }, - "start": Object { - "column": 15, - "line": 3, - }, - }, - "range": Array [ - 35, - 41, - ], - "type": "TSNumberKeyword", - }, - ], - "range": Array [ - 34, - 42, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "range": Array [ - 24, - 70, - ], - "type": "JSXElement", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 4, - }, - "start": Object { - "column": 50, - "line": 3, - }, - }, - "range": Array [ - 70, - 75, - ], - "raw": " - ", - "type": "Literal", - "value": " - ", - }, - Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 4, - }, - "start": Object { - "column": 42, - "line": 4, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 4, - }, - "start": Object { - "column": 44, - "line": 4, - }, - }, - "name": "Component", - "range": Array [ - 115, - 124, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 113, - 125, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 54, - "line": 4, - }, - "start": Object { - "column": 4, - "line": 4, - }, - }, - "openingElement": Object { - "attributes": Array [ - Object { + "openingElement": Object { + "attributes": Array [], "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 15, + "line": 3, }, "start": Object { - "column": 23, - "line": 4, + "column": 8, + "line": 3, }, }, "name": Object { "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 12, + "line": 3, }, "start": Object { - "column": 23, - "line": 4, + "column": 9, + "line": 3, }, }, - "name": "foo", + "name": "Foo", "range": Array [ - 94, - 97, + 43, + 46, ], "type": "JSXIdentifier", }, "range": Array [ - 94, - 97, + 42, + 49, ], - "type": "JSXAttribute", - "value": null, + "selfClosing": true, + "type": "JSXOpeningElement", }, - ], + "range": Array [ + 42, + 49, + ], + "type": "JSXElement", + }, "loc": Object { "end": Object { - "column": 42, + "column": 6, "line": 4, }, "start": Object { "column": 4, - "line": 4, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 4, - }, - "start": Object { - "column": 5, - "line": 4, - }, + "line": 2, }, - "name": "Component", - "range": Array [ - 76, - 85, - ], - "type": "JSXIdentifier", }, "range": Array [ - 75, - 113, + 25, + 63, ], - "selfClosing": false, - "type": "JSXOpeningElement", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 4, - }, - "start": Object { - "column": 14, - "line": 4, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 4, - }, - "start": Object { - "column": 15, - "line": 4, - }, - }, - "range": Array [ - 86, - 92, - ], - "type": "TSNumberKeyword", - }, - ], - "range": Array [ - 85, - 93, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "range": Array [ - 75, - 125, - ], - "type": "JSXElement", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 5, - }, - "start": Object { - "column": 54, - "line": 4, - }, - }, - "range": Array [ - 125, - 130, - ], - "raw": " - ", - "type": "Literal", - "value": " - ", - }, - Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { - "column": 42, - "line": 5, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 53, - "line": 5, - }, - "start": Object { - "column": 44, - "line": 5, - }, - }, - "name": "Component", - "range": Array [ - 170, - 179, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 168, - 180, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 54, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, + "type": "ReturnStatement", }, - "openingElement": Object { - "attributes": Array [ - Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 5, - }, - "start": Object { - "column": 38, - "line": 5, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 41, - "line": 5, - }, - "start": Object { - "column": 38, - "line": 5, - }, - }, - "name": "bar", - "range": Array [ - 164, - 167, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 164, - 167, - ], - "type": "JSXAttribute", - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 42, - "line": 5, - }, - "start": Object { - "column": 4, - "line": 5, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 5, - }, - "start": Object { - "column": 5, - "line": 5, - }, - }, - "name": "Component", - "range": Array [ - 131, - 140, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 130, - 168, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 5, - }, - "start": Object { - "column": 14, - "line": 5, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 5, - }, - "start": Object { - "column": 15, - "line": 5, - }, - }, - "range": Array [ - 141, - 147, - ], - "type": "TSNumberKeyword", - }, - ], - "range": Array [ - 140, - 148, - ], - "type": "TSTypeParameterInstantiation", - }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, }, - "range": Array [ - 130, - 180, - ], - "type": "JSXElement", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 6, - }, - "start": Object { - "column": 54, - "line": 5, - }, + "start": Object { + "column": 19, + "line": 1, }, - "range": Array [ - 180, - 185, - ], - "raw": " - ", - "type": "Literal", - "value": " - ", }, - Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 58, - "line": 6, - }, - "start": Object { - "column": 46, - "line": 6, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 6, - }, - "start": Object { - "column": 48, - "line": 6, - }, - }, - "name": "Component", - "range": Array [ - 229, - 238, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 227, - 239, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 58, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "openingElement": Object { - "attributes": Array [ - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 6, - }, - "start": Object { - "column": 23, - "line": 6, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 6, - }, - "start": Object { - "column": 23, - "line": 6, - }, - }, - "name": "foo", - "range": Array [ - 204, - 207, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 204, - 207, - ], - "type": "JSXAttribute", - "value": null, - }, - Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 6, - }, - "start": Object { - "column": 42, - "line": 6, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 6, - }, - "start": Object { - "column": 42, - "line": 6, - }, - }, - "name": "bar", - "range": Array [ - 223, - 226, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 223, - 226, - ], - "type": "JSXAttribute", - "value": null, - }, - ], - "loc": Object { - "end": Object { - "column": 46, - "line": 6, - }, - "start": Object { - "column": 4, - "line": 6, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 14, - "line": 6, - }, - "start": Object { - "column": 5, - "line": 6, - }, - }, - "name": "Component", - "range": Array [ - 186, - 195, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 185, - 227, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - "typeParameters": Object { - "loc": Object { - "end": Object { - "column": 22, - "line": 6, - }, - "start": Object { - "column": 14, - "line": 6, - }, - }, - "params": Array [ - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 6, - }, - "start": Object { - "column": 15, - "line": 6, - }, - }, - "range": Array [ - 196, - 202, - ], - "type": "TSNumberKeyword", - }, - ], - "range": Array [ - 195, - 203, - ], - "type": "TSTypeParameterInstantiation", - }, - }, - "range": Array [ - 185, - 239, - ], - "type": "JSXElement", + "range": Array [ + 19, + 65, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 8, - }, - "start": Object { - "column": 58, - "line": 6, - }, - }, - "range": Array [ - 239, - 245, - ], - "raw": " - - ", - "type": "Literal", - "value": " - - ", + "start": Object { + "column": 13, + "line": 1, }, - Object { - "children": Array [], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 10, - }, - "start": Object { - "column": 5, - "line": 10, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 10, - }, - "start": Object { - "column": 7, - "line": 10, - }, - }, - "name": "Component", - "range": Array [ - 289, + }, + "params": Array [], + "range": Array [ + 13, + 65, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 65, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "Line", + "value": " Foo", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "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": "Identifier", + "value": "pure", + }, + 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": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 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": 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": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "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[`Comments fixtures/jsx-generic-with-comment-in-tag.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "comp", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "raw": " + ", + "type": "Literal", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "name": "Component", + "range": Array [ + 60, + 69, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 58, + 70, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "Component", + "range": Array [ + 25, + 34, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 24, + 58, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 34, + 42, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 24, + 70, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 50, + "line": 3, + }, + }, + "range": Array [ + 70, + 75, + ], + "raw": " + ", + "type": "Literal", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 4, + }, + "start": Object { + "column": 42, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 44, + "line": 4, + }, + }, + "name": "Component", + "range": Array [ + 115, + 124, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 113, + 125, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 54, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "name": "foo", + "range": Array [ + 94, + 97, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 94, + 97, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "Component", + "range": Array [ + 76, + 85, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 75, + 113, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 86, + 92, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 85, + 93, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 75, + 125, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 4, + }, + }, + "range": Array [ + 125, + 130, + ], + "raw": " + ", + "type": "Literal", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 5, + }, + "start": Object { + "column": 44, + "line": 5, + }, + }, + "name": "Component", + "range": Array [ + 170, + 179, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 168, + 180, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "name": "bar", + "range": Array [ + 164, + 167, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 164, + 167, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "name": "Component", + "range": Array [ + 131, + 140, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 130, + 168, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 141, + 147, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 140, + 148, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 130, + 180, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 180, + 185, + ], + "raw": " + ", + "type": "Literal", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 6, + }, + "start": Object { + "column": 46, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 6, + }, + "start": Object { + "column": 48, + "line": 6, + }, + }, + "name": "Component", + "range": Array [ + 229, + 238, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 227, + 239, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 58, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 204, + 207, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 204, + 207, + ], + "type": "JSXAttribute", + "value": null, + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "name": "bar", + "range": Array [ + 223, + 226, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 223, + 226, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 46, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "name": "Component", + "range": Array [ + 186, + 195, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 185, + 227, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 196, + 202, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 195, + 203, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 185, + 239, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 8, + }, + "start": Object { + "column": 58, + "line": 6, + }, + }, + "range": Array [ + 239, + 245, + ], + "raw": " + + ", + "type": "Literal", + "value": " + + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 10, + }, + "start": Object { + "column": 5, + "line": 10, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 7, + "line": 10, + }, + }, + "name": "Component", + "range": Array [ + 289, 298, ], "type": "JSXIdentifier", @@ -4591,290 +5143,1358 @@ Object { "type": "VariableDeclarator", }, ], - "kind": "const", + "kind": "const", + "loc": Object { + "end": Object { + "column": 2, + "line": 25, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 525, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 43, + 57, + ], + "type": "Block", + "value": " comment1 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 98, + 112, + ], + "type": "Block", + "value": " comment2 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 149, + 163, + ], + "type": "Block", + "value": " comment3 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 208, + 222, + ], + "type": "Block", + "value": " comment4 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 270, + 281, + ], + "type": "Line", + "value": " comment5", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 13, + }, + "start": Object { + "column": 6, + "line": 13, + }, + }, + "range": Array [ + 339, + 350, + ], + "type": "Line", + "value": " comment6", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 16, + }, + "start": Object { + "column": 6, + "line": 16, + }, + }, + "range": Array [ + 398, + 409, + ], + "type": "Line", + "value": " comment7", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 21, + }, + "start": Object { + "column": 6, + "line": 21, + }, + }, + "range": Array [ + 477, + 488, + ], + "type": "Line", + "value": " comment8", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 26, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 526, + ], + "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": "Identifier", + "value": "comp", + }, + 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": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 25, + 34, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 50, + "line": 3, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 76, + 85, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 86, + 92, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 94, + 97, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 4, + }, + "start": Object { + "column": 42, + "line": 4, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 4, + }, + "start": Object { + "column": 43, + "line": 4, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 44, + "line": 4, + }, + }, + "range": Array [ + 115, + 124, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 4, + }, + "start": Object { + "column": 53, + "line": 4, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 4, + }, + }, + "range": Array [ + 125, + 130, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 131, + 140, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 141, + 147, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 164, + 167, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 41, + "line": 5, + }, + }, + "range": Array [ + 167, + 168, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 5, + }, + "start": Object { + "column": 43, + "line": 5, + }, + }, + "range": Array [ + 169, + 170, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 5, + }, + "start": Object { + "column": 44, + "line": 5, + }, + }, + "range": Array [ + 170, + 179, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 53, + "line": 5, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 180, + 185, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 185, + 186, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 186, + 195, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 196, + 202, + ], + "type": "Identifier", + "value": "number", + }, + Object { "loc": Object { "end": Object { - "column": 2, - "line": 25, + "column": 22, + "line": 6, }, "start": Object { - "column": 0, - "line": 1, + "column": 21, + "line": 6, }, }, "range": Array [ - 0, - 525, + 202, + 203, ], - "type": "VariableDeclaration", + "type": "Punctuator", + "value": ">", }, - ], - "comments": Array [ Object { "loc": Object { "end": Object { - "column": 37, - "line": 3, + "column": 26, + "line": 6, }, "start": Object { "column": 23, - "line": 3, + "line": 6, }, }, "range": Array [ - 43, - 57, + 204, + 207, ], - "type": "Block", - "value": " comment1 ", + "type": "JSXIdentifier", + "value": "foo", }, Object { "loc": Object { "end": Object { - "column": 41, - "line": 4, + "column": 45, + "line": 6, }, "start": Object { - "column": 27, - "line": 4, + "column": 42, + "line": 6, }, }, "range": Array [ - 98, - 112, + 223, + 226, ], - "type": "Block", - "value": " comment2 ", + "type": "JSXIdentifier", + "value": "bar", }, Object { "loc": Object { "end": Object { - "column": 37, - "line": 5, + "column": 46, + "line": 6, }, "start": Object { - "column": 23, - "line": 5, + "column": 45, + "line": 6, }, }, "range": Array [ - 149, - 163, + 226, + 227, ], - "type": "Block", - "value": " comment3 ", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 41, + "column": 47, "line": 6, }, "start": Object { - "column": 27, + "column": 46, "line": 6, }, }, "range": Array [ - 208, - 222, + 227, + 228, ], - "type": "Block", - "value": " comment4 ", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 9, + "column": 48, + "line": 6, }, "start": Object { - "column": 6, - "line": 9, + "column": 47, + "line": 6, }, }, "range": Array [ - 270, - 281, + 228, + 229, ], - "type": "Line", - "value": " comment5", + "type": "Punctuator", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 13, + "column": 57, + "line": 6, }, "start": Object { - "column": 6, - "line": 13, + "column": 48, + "line": 6, }, }, "range": Array [ - 339, - 350, + 229, + 238, ], - "type": "Line", - "value": " comment6", + "type": "JSXIdentifier", + "value": "Component", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 16, + "column": 58, + "line": 6, }, "start": Object { - "column": 6, - "line": 16, + "column": 57, + "line": 6, }, }, "range": Array [ - 398, - 409, + 238, + 239, ], - "type": "Line", - "value": " comment7", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 21, + "column": 4, + "line": 8, }, "start": Object { - "column": 6, - "line": 21, + "column": 58, + "line": 6, }, }, "range": Array [ - 477, - 488, + 239, + 245, ], - "type": "Line", - "value": " comment8", - }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 26, + "type": "JSXText", + "value": " + + ", }, - "start": Object { - "column": 0, - "line": 1, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 245, + 246, + ], + "type": "Punctuator", + "value": "<", }, - }, - "range": Array [ - 0, - 526, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { "column": 5, - "line": 1, + "line": 8, + }, + }, + "range": Array [ + 246, + 255, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, }, "start": Object { - "column": 0, - "line": 1, + "column": 14, + "line": 8, }, }, "range": Array [ - 0, - 5, + 255, + 256, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 256, + 262, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 8, + }, + "start": Object { + "column": 21, + "line": 8, + }, + }, + "range": Array [ + 262, + 263, + ], + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 5, + "line": 10, }, "start": Object { - "column": 6, - "line": 1, + "column": 4, + "line": 10, }, }, "range": Array [ - 6, - 10, + 286, + 287, ], - "type": "Identifier", - "value": "comp", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 6, + "line": 10, }, "start": Object { - "column": 11, - "line": 1, + "column": 5, + "line": 10, }, }, "range": Array [ - 11, - 12, + 287, + 288, ], "type": "Punctuator", - "value": "=", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 7, + "line": 10, }, "start": Object { - "column": 13, - "line": 1, + "column": 6, + "line": 10, }, }, "range": Array [ - 13, - 14, + 288, + 289, ], "type": "Punctuator", - "value": "(", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 3, - "line": 2, + "column": 16, + "line": 10, }, "start": Object { - "column": 2, - "line": 2, + "column": 7, + "line": 10, }, }, "range": Array [ - 17, - 18, + 289, + 298, ], - "type": "Punctuator", - "value": "<", + "type": "JSXIdentifier", + "value": "Component", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 10, }, "start": Object { - "column": 3, - "line": 2, + "column": 16, + "line": 10, }, }, "range": Array [ - 18, - 19, + 298, + 299, ], "type": "Punctuator", "value": ">", @@ -4883,16 +6503,16 @@ Object { "loc": Object { "end": Object { "column": 4, - "line": 3, + "line": 11, }, "start": Object { - "column": 4, - "line": 2, + "column": 17, + "line": 10, }, }, "range": Array [ - 19, - 24, + 299, + 304, ], "type": "JSXText", "value": " @@ -4902,16 +6522,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 3, + "line": 11, }, "start": Object { "column": 4, - "line": 3, + "line": 11, }, }, "range": Array [ - 24, - 25, + 304, + 305, ], "type": "Punctuator", "value": "<", @@ -4920,16 +6540,16 @@ Object { "loc": Object { "end": Object { "column": 14, - "line": 3, + "line": 11, }, "start": Object { "column": 5, - "line": 3, + "line": 11, }, }, "range": Array [ - 25, - 34, + 305, + 314, ], "type": "JSXIdentifier", "value": "Component", @@ -4938,16 +6558,16 @@ Object { "loc": Object { "end": Object { "column": 15, - "line": 3, + "line": 11, }, "start": Object { "column": 14, - "line": 3, + "line": 11, }, }, "range": Array [ - 34, - 35, + 314, + 315, ], "type": "Punctuator", "value": "<", @@ -4956,16 +6576,16 @@ Object { "loc": Object { "end": Object { "column": 21, - "line": 3, + "line": 11, }, "start": Object { "column": 15, - "line": 3, + "line": 11, }, }, "range": Array [ - 35, - 41, + 315, + 321, ], "type": "Identifier", "value": "number", @@ -4974,16 +6594,16 @@ Object { "loc": Object { "end": Object { "column": 22, - "line": 3, + "line": 11, }, "start": Object { "column": 21, - "line": 3, + "line": 11, }, }, "range": Array [ - 41, - 42, + 321, + 322, ], "type": "Punctuator", "value": ">", @@ -4991,17 +6611,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 38, - "line": 3, + "column": 9, + "line": 12, }, "start": Object { - "column": 37, - "line": 3, + "column": 6, + "line": 12, }, }, "range": Array [ - 57, - 58, + 329, + 332, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 355, + 356, ], "type": "Punctuator", "value": ">", @@ -5009,17 +6647,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 39, - "line": 3, + "column": 6, + "line": 14, }, "start": Object { - "column": 38, - "line": 3, + "column": 5, + "line": 14, }, }, "range": Array [ - 58, - 59, + 356, + 357, ], "type": "Punctuator", "value": "<", @@ -5027,17 +6665,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 40, - "line": 3, + "column": 7, + "line": 14, }, "start": Object { - "column": 39, - "line": 3, + "column": 6, + "line": 14, }, }, "range": Array [ - 59, - 60, + 357, + 358, ], "type": "Punctuator", "value": "/", @@ -5045,17 +6683,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 49, - "line": 3, + "column": 16, + "line": 14, }, "start": Object { - "column": 40, - "line": 3, + "column": 7, + "line": 14, }, }, "range": Array [ - 60, - 69, + 358, + 367, ], "type": "JSXIdentifier", "value": "Component", @@ -5063,17 +6701,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 50, - "line": 3, + "column": 17, + "line": 14, }, "start": Object { - "column": 49, - "line": 3, + "column": 16, + "line": 14, }, }, "range": Array [ - 69, - 70, + 367, + 368, ], "type": "Punctuator", "value": ">", @@ -5082,16 +6720,16 @@ Object { "loc": Object { "end": Object { "column": 4, - "line": 4, + "line": 15, }, "start": Object { - "column": 50, - "line": 3, + "column": 17, + "line": 14, }, }, "range": Array [ - 70, - 75, + 368, + 373, ], "type": "JSXText", "value": " @@ -5101,16 +6739,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 4, + "line": 15, }, "start": Object { "column": 4, - "line": 4, + "line": 15, }, }, "range": Array [ - 75, - 76, + 373, + 374, ], "type": "Punctuator", "value": "<", @@ -5119,16 +6757,16 @@ Object { "loc": Object { "end": Object { "column": 14, - "line": 4, + "line": 15, }, "start": Object { "column": 5, - "line": 4, + "line": 15, }, }, "range": Array [ - 76, - 85, + 374, + 383, ], "type": "JSXIdentifier", "value": "Component", @@ -5137,16 +6775,16 @@ Object { "loc": Object { "end": Object { "column": 15, - "line": 4, + "line": 15, }, "start": Object { "column": 14, - "line": 4, + "line": 15, }, }, "range": Array [ - 85, - 86, + 383, + 384, ], "type": "Punctuator", "value": "<", @@ -5155,16 +6793,16 @@ Object { "loc": Object { "end": Object { "column": 21, - "line": 4, + "line": 15, }, "start": Object { "column": 15, - "line": 4, + "line": 15, }, }, "range": Array [ - 86, - 92, + 384, + 390, ], "type": "Identifier", "value": "number", @@ -5173,16 +6811,16 @@ Object { "loc": Object { "end": Object { "column": 22, - "line": 4, + "line": 15, }, "start": Object { "column": 21, - "line": 4, + "line": 15, }, }, "range": Array [ - 92, - 93, + 390, + 391, ], "type": "Punctuator", "value": ">", @@ -5190,17 +6828,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 26, - "line": 4, + "column": 9, + "line": 17, }, "start": Object { - "column": 23, - "line": 4, + "column": 6, + "line": 17, }, }, "range": Array [ - 94, - 97, + 416, + 419, ], "type": "JSXIdentifier", "value": "foo", @@ -5208,17 +6846,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, - "line": 4, + "column": 5, + "line": 18, }, "start": Object { - "column": 41, - "line": 4, + "column": 4, + "line": 18, }, }, "range": Array [ - 112, - 113, + 424, + 425, ], "type": "Punctuator", "value": ">", @@ -5226,17 +6864,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, - "line": 4, + "column": 6, + "line": 18, }, "start": Object { - "column": 42, - "line": 4, + "column": 5, + "line": 18, }, }, "range": Array [ - 113, - 114, + 425, + 426, ], "type": "Punctuator", "value": "<", @@ -5244,17 +6882,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, - "line": 4, + "column": 7, + "line": 18, }, "start": Object { - "column": 43, - "line": 4, + "column": 6, + "line": 18, }, }, "range": Array [ - 114, - 115, + 426, + 427, ], "type": "Punctuator", "value": "/", @@ -5262,17 +6900,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 53, - "line": 4, + "column": 16, + "line": 18, }, "start": Object { - "column": 44, - "line": 4, + "column": 7, + "line": 18, }, }, "range": Array [ - 115, - 124, + 427, + 436, ], "type": "JSXIdentifier", "value": "Component", @@ -5280,17 +6918,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 54, - "line": 4, + "column": 17, + "line": 18, }, "start": Object { - "column": 53, - "line": 4, + "column": 16, + "line": 18, }, }, "range": Array [ - 124, - 125, + 436, + 437, ], "type": "Punctuator", "value": ">", @@ -5299,16 +6937,16 @@ Object { "loc": Object { "end": Object { "column": 4, - "line": 5, + "line": 19, }, "start": Object { - "column": 54, - "line": 4, + "column": 17, + "line": 18, }, }, "range": Array [ - 125, - 130, + 437, + 442, ], "type": "JSXText", "value": " @@ -5318,16 +6956,16 @@ Object { "loc": Object { "end": Object { "column": 5, - "line": 5, + "line": 19, }, "start": Object { "column": 4, - "line": 5, + "line": 19, }, }, "range": Array [ - 130, - 131, + 442, + 443, ], "type": "Punctuator", "value": "<", @@ -5336,16 +6974,16 @@ Object { "loc": Object { "end": Object { "column": 14, - "line": 5, + "line": 19, }, "start": Object { "column": 5, - "line": 5, + "line": 19, }, }, "range": Array [ - 131, - 140, + 443, + 452, ], "type": "JSXIdentifier", "value": "Component", @@ -5354,16 +6992,16 @@ Object { "loc": Object { "end": Object { "column": 15, - "line": 5, + "line": 19, }, "start": Object { "column": 14, - "line": 5, + "line": 19, }, }, "range": Array [ - 140, - 141, + 452, + 453, ], "type": "Punctuator", "value": "<", @@ -5372,16 +7010,16 @@ Object { "loc": Object { "end": Object { "column": 21, - "line": 5, + "line": 19, }, "start": Object { "column": 15, - "line": 5, + "line": 19, }, }, "range": Array [ - 141, - 147, + 453, + 459, ], "type": "Identifier", "value": "number", @@ -5390,16 +7028,16 @@ Object { "loc": Object { "end": Object { "column": 22, - "line": 5, + "line": 19, }, "start": Object { "column": 21, - "line": 5, + "line": 19, }, }, "range": Array [ - 147, - 148, + 459, + 460, ], "type": "Punctuator", "value": ">", @@ -5407,17 +7045,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 41, - "line": 5, + "column": 9, + "line": 20, }, "start": Object { - "column": 38, - "line": 5, + "column": 6, + "line": 20, }, }, "range": Array [ - 164, - 167, + 467, + 470, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 22, + }, + "start": Object { + "column": 6, + "line": 22, + }, + }, + "range": Array [ + 495, + 498, ], "type": "JSXIdentifier", "value": "bar", @@ -5425,17 +7081,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 42, - "line": 5, + "column": 5, + "line": 23, }, "start": Object { - "column": 41, - "line": 5, + "column": 4, + "line": 23, }, }, "range": Array [ - 167, - 168, + 503, + 504, ], "type": "Punctuator", "value": ">", @@ -5443,17 +7099,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 43, - "line": 5, + "column": 6, + "line": 23, }, "start": Object { - "column": 42, - "line": 5, + "column": 5, + "line": 23, }, }, "range": Array [ - 168, - 169, + 504, + 505, ], "type": "Punctuator", "value": "<", @@ -5461,17 +7117,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 44, - "line": 5, + "column": 7, + "line": 23, }, "start": Object { - "column": 43, - "line": 5, + "column": 6, + "line": 23, }, }, "range": Array [ - 169, - 170, + 505, + 506, ], "type": "Punctuator", "value": "/", @@ -5479,17 +7135,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 53, - "line": 5, + "column": 16, + "line": 23, }, "start": Object { - "column": 44, - "line": 5, + "column": 7, + "line": 23, }, }, "range": Array [ - 170, - 179, + 506, + 515, ], "type": "JSXIdentifier", "value": "Component", @@ -5497,17 +7153,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 54, - "line": 5, + "column": 17, + "line": 23, }, "start": Object { - "column": 53, - "line": 5, + "column": 16, + "line": 23, }, }, "range": Array [ - 179, - 180, + 515, + 516, ], "type": "Punctuator", "value": ">", @@ -5515,905 +7171,1194 @@ Object { Object { "loc": Object { "end": Object { - "column": 4, - "line": 6, + "column": 2, + "line": 24, }, "start": Object { - "column": 54, - "line": 5, + "column": 17, + "line": 23, }, }, "range": Array [ - 180, - 185, + 516, + 519, ], "type": "JSXText", "value": " - ", + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 24, + }, + "start": Object { + "column": 2, + "line": 24, + }, + }, + "range": Array [ + 519, + 520, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 24, + }, + "start": Object { + "column": 3, + "line": 24, + }, + }, + "range": Array [ + 520, + 521, + ], + "type": "Punctuator", + "value": "/", }, Object { "loc": Object { "end": Object { "column": 5, - "line": 6, + "line": 24, }, "start": Object { "column": 4, - "line": 6, + "line": 24, }, }, "range": Array [ - 185, - 186, + 521, + 522, ], "type": "Punctuator", - "value": "<", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 6, + "column": 1, + "line": 25, }, "start": Object { - "column": 5, - "line": 6, + "column": 0, + "line": 25, }, }, "range": Array [ - 186, - 195, + 523, + 524, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 6, + "column": 2, + "line": 25, }, "start": Object { - "column": 14, - "line": 6, + "column": 1, + "line": 25, + }, + }, + "range": Array [ + 524, + 525, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/jsx-tag-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "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": 6, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 125, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 127, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 127, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 127, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 195, - 196, ], - "type": "Punctuator", - "value": "<", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 21, - "line": 6, + "column": 1, + "line": 9, }, "start": Object { - "column": 15, - "line": 6, + "column": 0, + "line": 1, }, }, "range": Array [ - 196, - 202, + 0, + 127, ], - "type": "Identifier", - "value": "number", + "type": "VariableDeclaration", }, + ], + "comments": Array [ Object { "loc": Object { "end": Object { - "column": 22, - "line": 6, - }, - "start": Object { "column": 21, - "line": 6, - }, - }, - "range": Array [ - 202, - 203, - ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 26, - "line": 6, - }, - "start": Object { - "column": 23, - "line": 6, - }, - }, - "range": Array [ - 204, - 207, - ], - "type": "JSXIdentifier", - "value": "foo", - }, - Object { - "loc": Object { - "end": Object { - "column": 45, - "line": 6, - }, - "start": Object { - "column": 42, - "line": 6, - }, - }, - "range": Array [ - 223, - 226, - ], - "type": "JSXIdentifier", - "value": "bar", - }, - Object { - "loc": Object { - "end": Object { - "column": 46, - "line": 6, - }, - "start": Object { - "column": 45, - "line": 6, - }, - }, - "range": Array [ - 226, - 227, - ], - "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 47, - "line": 6, - }, - "start": Object { - "column": 46, - "line": 6, - }, - }, - "range": Array [ - 227, - 228, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 48, - "line": 6, - }, - "start": Object { - "column": 47, - "line": 6, - }, - }, - "range": Array [ - 228, - 229, - ], - "type": "Punctuator", - "value": "/", - }, - Object { - "loc": Object { - "end": Object { - "column": 57, - "line": 6, + "line": 4, }, "start": Object { - "column": 48, - "line": 6, + "column": 12, + "line": 4, }, }, "range": Array [ - 229, - 238, + 59, + 68, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Line", + "value": " single", }, Object { "loc": Object { "end": Object { - "column": 58, - "line": 6, + "column": 23, + "line": 5, }, "start": Object { - "column": 57, - "line": 6, + "column": 12, + "line": 5, }, }, "range": Array [ - 238, - 239, + 81, + 92, ], - "type": "Punctuator", - "value": ">", + "type": "Block", + "value": " block ", }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 8, - }, - "start": Object { - "column": 58, - "line": 6, - }, - }, - "range": Array [ - 239, - 245, - ], - "type": "JSXText", - "value": " - - ", + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 11, }, - Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 8, - }, - "start": Object { - "column": 4, - "line": 8, - }, - }, - "range": Array [ - 245, - 246, - ], - "type": "Punctuator", - "value": "<", + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 129, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 14, - "line": 8, - }, - "start": Object { "column": 5, - "line": 8, - }, - }, - "range": Array [ - 246, - 255, - ], - "type": "JSXIdentifier", - "value": "Component", - }, - Object { - "loc": Object { - "end": Object { - "column": 15, - "line": 8, - }, - "start": Object { - "column": 14, - "line": 8, - }, - }, - "range": Array [ - 255, - 256, - ], - "type": "Punctuator", - "value": "<", - }, - Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 8, + "line": 1, }, "start": Object { - "column": 15, - "line": 8, + "column": 0, + "line": 1, }, }, "range": Array [ - 256, - 262, + 0, + 5, ], - "type": "Identifier", - "value": "number", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 8, + "column": 10, + "line": 1, }, "start": Object { - "column": 21, - "line": 8, + "column": 6, + "line": 1, }, }, "range": Array [ - 262, - 263, + 6, + 10, ], - "type": "Punctuator", - "value": ">", + "type": "Identifier", + "value": "pure", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 10, + "column": 12, + "line": 1, }, "start": Object { - "column": 4, - "line": 10, + "column": 11, + "line": 1, }, }, "range": Array [ - 286, - 287, + 11, + 12, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 10, + "column": 14, + "line": 1, }, "start": Object { - "column": 5, - "line": 10, + "column": 13, + "line": 1, }, }, "range": Array [ - 287, - 288, + 13, + 14, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 10, + "column": 15, + "line": 1, }, "start": Object { - "column": 6, - "line": 10, + "column": 14, + "line": 1, }, }, "range": Array [ - 288, - 289, + 14, + 15, ], "type": "Punctuator", - "value": "/", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 10, + "column": 18, + "line": 1, }, "start": Object { - "column": 7, - "line": 10, + "column": 16, + "line": 1, }, }, "range": Array [ - 289, - 298, + 16, + 18, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Punctuator", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 10, + "column": 20, + "line": 1, }, "start": Object { - "column": 16, - "line": 10, + "column": 19, + "line": 1, }, }, "range": Array [ - 298, - 299, + 19, + 20, ], "type": "Punctuator", - "value": ">", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 11, + "column": 10, + "line": 2, }, "start": Object { - "column": 17, - "line": 10, + "column": 4, + "line": 2, }, }, "range": Array [ - 299, - 304, + 25, + 31, ], - "type": "JSXText", - "value": " - ", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 11, + "column": 12, + "line": 2, }, "start": Object { - "column": 4, - "line": 11, + "column": 11, + "line": 2, }, }, "range": Array [ - 304, - 305, + 32, + 33, ], "type": "Punctuator", - "value": "<", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 11, + "column": 9, + "line": 3, }, "start": Object { - "column": 5, - "line": 11, + "column": 8, + "line": 3, }, }, "range": Array [ - 305, - 314, + 42, + 43, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 11, + "column": 12, + "line": 3, }, "start": Object { - "column": 14, - "line": 11, + "column": 9, + "line": 3, }, }, "range": Array [ - 314, - 315, + 43, + 46, ], - "type": "Punctuator", - "value": "<", + "type": "JSXIdentifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 11, + "column": 9, + "line": 6, }, "start": Object { - "column": 15, - "line": 11, + "column": 8, + "line": 6, }, }, "range": Array [ - 315, - 321, + 102, + 103, ], - "type": "Identifier", - "value": "number", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 11, + "column": 8, + "line": 7, }, "start": Object { - "column": 21, - "line": 11, + "column": 9, + "line": 6, }, }, "range": Array [ - 321, - 322, + 103, + 112, ], - "type": "Punctuator", - "value": ">", + "type": "JSXText", + "value": " + ", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 12, + "line": 7, }, "start": Object { - "column": 6, - "line": 12, + "column": 8, + "line": 7, }, }, "range": Array [ - 329, - 332, + 112, + 113, ], - "type": "JSXIdentifier", - "value": "foo", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 14, + "column": 10, + "line": 7, }, "start": Object { - "column": 4, - "line": 14, + "column": 9, + "line": 7, }, }, "range": Array [ - 355, - 356, + 113, + 114, ], "type": "Punctuator", - "value": ">", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 14, + "column": 13, + "line": 7, }, "start": Object { - "column": 5, - "line": 14, + "column": 10, + "line": 7, }, }, "range": Array [ - 356, - 357, + 114, + 117, ], - "type": "Punctuator", - "value": "<", + "type": "JSXIdentifier", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 14, + "column": 14, + "line": 7, }, "start": Object { - "column": 6, - "line": 14, + "column": 13, + "line": 7, }, }, "range": Array [ - 357, - 358, + 117, + 118, ], "type": "Punctuator", - "value": "/", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 14, + "column": 5, + "line": 8, }, "start": Object { - "column": 7, - "line": 14, + "column": 4, + "line": 8, }, }, "range": Array [ - 358, - 367, + 123, + 124, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Punctuator", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 14, + "column": 6, + "line": 8, }, "start": Object { - "column": 16, - "line": 14, + "column": 5, + "line": 8, }, }, "range": Array [ - 367, - 368, + 124, + 125, ], "type": "Punctuator", - "value": ">", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 15, + "column": 1, + "line": 9, }, "start": Object { - "column": 17, - "line": 14, + "column": 0, + "line": 9, }, }, "range": Array [ - 368, - 373, + 126, + 127, ], - "type": "JSXText", - "value": " - ", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/jsx-text-with-multiline-non-comment.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 5, - "line": 15, - }, - "start": Object { - "column": 4, - "line": 15, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 41, + 80, + ], + "raw": " + /** + * test + */ + ", + "type": "Literal", + "value": " + /** + * test + */ + ", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "Foo", + "range": Array [ + 82, + 85, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 80, + 86, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 37, + 40, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 36, + 41, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 36, + 86, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 91, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 93, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 93, + ], + "type": "ArrowFunctionExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 93, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 373, - 374, ], - "type": "Punctuator", - "value": "<", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 14, - "line": 15, + "column": 1, + "line": 9, }, "start": Object { - "column": 5, - "line": 15, + "column": 0, + "line": 1, }, }, "range": Array [ - 374, - 383, + 0, + 93, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, }, + }, + "range": Array [ + 0, + 94, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 15, - "line": 15, + "column": 5, + "line": 1, }, "start": Object { - "column": 14, - "line": 15, + "column": 0, + "line": 1, }, }, "range": Array [ - 383, - 384, + 0, + 5, ], - "type": "Punctuator", - "value": "<", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 15, + "column": 10, + "line": 1, }, "start": Object { - "column": 15, - "line": 15, + "column": 6, + "line": 1, }, }, "range": Array [ - 384, - 390, + 6, + 10, ], "type": "Identifier", - "value": "number", + "value": "pure", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 15, + "column": 12, + "line": 1, }, "start": Object { - "column": 21, - "line": 15, + "column": 11, + "line": 1, }, }, "range": Array [ - 390, - 391, + 11, + 12, ], "type": "Punctuator", - "value": ">", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 17, + "column": 14, + "line": 1, }, "start": Object { - "column": 6, - "line": 17, + "column": 13, + "line": 1, }, }, "range": Array [ - 416, - 419, + 13, + 14, ], - "type": "JSXIdentifier", - "value": "foo", + "type": "Punctuator", + "value": "(", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 18, + "column": 15, + "line": 1, }, "start": Object { - "column": 4, - "line": 18, + "column": 14, + "line": 1, }, }, "range": Array [ - 424, - 425, + 14, + 15, ], "type": "Punctuator", - "value": ">", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 18, + "column": 18, + "line": 1, }, "start": Object { - "column": 5, - "line": 18, + "column": 16, + "line": 1, }, }, "range": Array [ - 425, - 426, + 16, + 18, ], "type": "Punctuator", - "value": "<", + "value": "=>", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 18, + "column": 20, + "line": 1, }, "start": Object { - "column": 6, - "line": 18, + "column": 19, + "line": 1, }, }, "range": Array [ - 426, - 427, + 19, + 20, ], "type": "Punctuator", - "value": "/", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 18, + "column": 8, + "line": 2, }, "start": Object { - "column": 7, - "line": 18, + "column": 2, + "line": 2, }, }, "range": Array [ - 427, - 436, + 23, + 29, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Keyword", + "value": "return", }, Object { "loc": Object { "end": Object { - "column": 17, - "line": 18, + "column": 10, + "line": 2, }, "start": Object { - "column": 16, - "line": 18, + "column": 9, + "line": 2, }, }, "range": Array [ - 436, - 437, + 30, + 31, ], "type": "Punctuator", - "value": ">", - }, - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 19, - }, - "start": Object { - "column": 17, - "line": 18, - }, - }, - "range": Array [ - 437, - 442, - ], - "type": "JSXText", - "value": " - ", + "value": "(", }, Object { "loc": Object { "end": Object { "column": 5, - "line": 19, + "line": 3, }, "start": Object { "column": 4, - "line": 19, + "line": 3, }, }, "range": Array [ - 442, - 443, + 36, + 37, ], "type": "Punctuator", "value": "<", @@ -6421,125 +8366,129 @@ Object { Object { "loc": Object { "end": Object { - "column": 14, - "line": 19, + "column": 8, + "line": 3, }, "start": Object { "column": 5, - "line": 19, + "line": 3, }, }, "range": Array [ - 443, - 452, + 37, + 40, ], "type": "JSXIdentifier", - "value": "Component", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 19, + "column": 9, + "line": 3, }, "start": Object { - "column": 14, - "line": 19, + "column": 8, + "line": 3, }, }, "range": Array [ - 452, - 453, + 40, + 41, ], "type": "Punctuator", - "value": "<", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 19, + "column": 4, + "line": 7, }, "start": Object { - "column": 15, - "line": 19, + "column": 9, + "line": 3, }, }, "range": Array [ - 453, - 459, - ], - "type": "Identifier", - "value": "number", + 41, + 80, + ], + "type": "JSXText", + "value": " + /** + * test + */ + ", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 19, + "column": 5, + "line": 7, }, "start": Object { - "column": 21, - "line": 19, + "column": 4, + "line": 7, }, }, "range": Array [ - 459, - 460, + 80, + 81, ], "type": "Punctuator", - "value": ">", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 20, + "column": 6, + "line": 7, }, "start": Object { - "column": 6, - "line": 20, + "column": 5, + "line": 7, }, }, "range": Array [ - 467, - 470, + 81, + 82, ], - "type": "JSXIdentifier", - "value": "foo", + "type": "Punctuator", + "value": "/", }, Object { "loc": Object { "end": Object { "column": 9, - "line": 22, + "line": 7, }, "start": Object { "column": 6, - "line": 22, + "line": 7, }, }, "range": Array [ - 495, - 498, + 82, + 85, ], "type": "JSXIdentifier", - "value": "bar", + "value": "Foo", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 23, + "column": 10, + "line": 7, }, "start": Object { - "column": 4, - "line": 23, + "column": 9, + "line": 7, }, }, "range": Array [ - 503, - 504, + 85, + 86, ], "type": "Punctuator", "value": ">", @@ -6547,396 +8496,1011 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, - "line": 23, + "column": 3, + "line": 8, }, "start": Object { - "column": 5, - "line": 23, + "column": 2, + "line": 8, }, }, "range": Array [ - 504, - 505, + 89, + 90, ], "type": "Punctuator", - "value": "<", + "value": ")", }, Object { "loc": Object { "end": Object { - "column": 7, - "line": 23, + "column": 4, + "line": 8, }, "start": Object { - "column": 6, - "line": 23, + "column": 3, + "line": 8, }, }, "range": Array [ - 505, - 506, + 90, + 91, ], "type": "Punctuator", - "value": "/", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 23, + "column": 1, + "line": 9, }, "start": Object { - "column": 7, - "line": 23, + "column": 0, + "line": 9, }, }, "range": Array [ - 506, - 515, + 92, + 93, ], - "type": "JSXIdentifier", - "value": "Component", + "type": "Punctuator", + "value": "}", }, + ], + "type": "Program", +} +`; + +exports[`Comments fixtures/jsx-text-with-url.src 1`] = ` +Object { + "body": Array [ Object { - "loc": Object { - "end": Object { - "column": 17, - "line": 23, - }, - "start": Object { - "column": 16, - "line": 23, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "first", + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 37, + ], + "raw": "http://example.com", + "type": "Literal", + "value": "http://example.com", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 37, + 43, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "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 [ + 14, + 19, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 14, + 43, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 43, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 515, - 516, ], - "type": "Punctuator", - "value": ">", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 2, - "line": 24, + "column": 44, + "line": 1, }, "start": Object { - "column": 17, - "line": 23, + "column": 0, + "line": 1, }, }, "range": Array [ - 516, - 519, + 0, + 44, ], - "type": "JSXText", - "value": " - ", + "type": "VariableDeclaration", }, Object { + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "second", + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 63, + 81, + ], + "raw": "http://example.com", + "type": "Literal", + "value": "http://example.com", + }, + ], + "closingFragment": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "range": Array [ + 81, + 84, + ], + "type": "JSXClosingFragment", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "openingFragment": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "JSXOpeningFragment", + }, + "range": Array [ + 61, + 84, + ], + "type": "JSXFragment", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 52, + 84, + ], + "type": "VariableDeclarator", + }, + ], + "kind": "const", "loc": Object { "end": Object { - "column": 3, - "line": 24, + "column": 39, + "line": 3, }, "start": Object { - "column": 2, - "line": 24, + "column": 0, + "line": 3, }, }, "range": Array [ - 519, - 520, + 46, + 85, ], - "type": "Punctuator", - "value": "<", + "type": "VariableDeclaration", }, Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 24, - }, - "start": Object { - "column": 3, - "line": 24, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "third", + "range": Array [ + 93, + 98, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [ + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "name": "br", + "range": Array [ + 107, + 109, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 106, + 112, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + }, + "range": Array [ + 106, + 112, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 5, + }, + "start": Object { + "column": 25, + "line": 5, + }, + }, + "range": Array [ + 112, + 130, + ], + "raw": "http://example.com", + "type": "Literal", + "value": "http://example.com", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 43, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "name": "div", + "range": Array [ + 132, + 135, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 130, + 136, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "name": "div", + "range": Array [ + 102, + 105, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 101, + 106, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 101, + 136, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 93, + 136, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 520, - 521, ], - "type": "Punctuator", - "value": "/", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 5, - "line": 24, + "column": 50, + "line": 5, }, "start": Object { - "column": 4, - "line": 24, + "column": 0, + "line": 5, }, }, "range": Array [ - 521, - 522, + 87, + 137, ], - "type": "Punctuator", - "value": ">", + "type": "VariableDeclaration", }, Object { - "loc": Object { - "end": Object { - "column": 1, - "line": 25, - }, - "start": Object { - "column": 0, - "line": 25, + "declarations": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "fourth", + "range": Array [ + 145, + 151, + ], + "type": "Identifier", + }, + "init": Object { + "children": Array [ + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 28, + "line": 7, + }, + }, + "name": "span", + "range": Array [ + 167, + 171, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 165, + 172, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 7, + }, + "start": Object { + "column": 21, + "line": 7, + }, + }, + "name": "span", + "range": Array [ + 160, + 164, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 159, + 165, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 159, + 172, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 7, + }, + "start": Object { + "column": 33, + "line": 7, + }, + }, + "range": Array [ + 172, + 190, + ], + "raw": "http://example.com", + "type": "Literal", + "value": "http://example.com", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 7, + }, + "start": Object { + "column": 51, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 7, + }, + "start": Object { + "column": 53, + "line": 7, + }, + }, + "name": "div", + "range": Array [ + 192, + 195, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 190, + 196, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "name": "div", + "range": Array [ + 155, + 158, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 154, + 159, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + }, + "range": Array [ + 154, + 196, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 145, + 196, + ], + "type": "VariableDeclarator", }, - }, - "range": Array [ - 523, - 524, ], - "type": "Punctuator", - "value": ")", - }, - Object { + "kind": "const", "loc": Object { "end": Object { - "column": 2, - "line": 25, + "column": 58, + "line": 7, }, "start": Object { - "column": 1, - "line": 25, + "column": 0, + "line": 7, }, }, "range": Array [ - 524, - 525, + 139, + 197, ], - "type": "Punctuator", - "value": ";", + "type": "VariableDeclaration", }, - ], - "type": "Program", -} -`; - -exports[`Comments fixtures/jsx-tag-comments.src 1`] = ` -Object { - "body": Array [ Object { "declarations": Array [ Object { "id": Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 11, + "line": 9, }, "start": Object { "column": 6, - "line": 1, + "line": 9, }, }, - "name": "pure", + "name": "fifth", "range": Array [ - 6, - 10, + 205, + 210, ], "type": "Identifier", }, "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", - }, + "children": Array [ + Object { + "expression": Object { "loc": Object { "end": Object { - "column": 6, - "line": 8, + "column": 20, + "line": 9, }, "start": Object { - "column": 4, - "line": 2, + "column": 20, + "line": 9, }, }, "range": Array [ - 25, - 125, + 219, + 219, ], - "type": "ReturnStatement", + "type": "JSXEmptyExpression", }, - ], + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 218, + 220, + ], + "type": "JSXExpressionContainer", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 9, + }, + "start": Object { + "column": 21, + "line": 9, + }, + }, + "range": Array [ + 220, + 238, + ], + "raw": "http://example.com", + "type": "Literal", + "value": "http://example.com", + }, + ], + "closingElement": Object { "loc": Object { "end": Object { - "column": 1, + "column": 45, "line": 9, }, "start": Object { + "column": 39, + "line": 9, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 9, + }, + "start": Object { + "column": 41, + "line": 9, + }, + }, + "name": "div", + "range": Array [ + 240, + 243, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 238, + 244, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { "column": 19, - "line": 1, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, }, + "name": "div", + "range": Array [ + 214, + 217, + ], + "type": "JSXIdentifier", }, "range": Array [ - 19, - 127, + 213, + 218, ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 13, - "line": 1, - }, + "selfClosing": false, + "type": "JSXOpeningElement", }, - "params": Array [], "range": Array [ - 13, - 127, + 213, + 244, ], - "type": "ArrowFunctionExpression", + "type": "JSXElement", }, "loc": Object { "end": Object { - "column": 1, + "column": 45, "line": 9, }, "start": Object { "column": 6, - "line": 1, + "line": 9, }, }, "range": Array [ - 6, - 127, + 205, + 244, ], "type": "VariableDeclarator", }, @@ -6944,378 +9508,538 @@ Object { "kind": "const", "loc": Object { "end": Object { - "column": 1, + "column": 46, "line": 9, }, "start": Object { "column": 0, - "line": 1, + "line": 9, }, }, "range": Array [ - 0, - 127, + 199, + 245, ], "type": "VariableDeclaration", }, ], - "comments": Array [ + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 246, + ], + "sourceType": "script", + "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 21, - "line": 4, + "column": 5, + "line": 1, }, "start": Object { - "column": 12, - "line": 4, + "column": 0, + "line": 1, }, }, "range": Array [ - 59, - 68, + 0, + 5, ], - "type": "Line", - "value": " single", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 23, - "line": 5, + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "value": "first", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, }, "start": Object { "column": 12, - "line": 5, + "line": 1, }, }, "range": Array [ - 81, - 92, + 12, + 13, ], - "type": "Block", - "value": " block ", + "type": "Punctuator", + "value": "=", }, - ], - "loc": Object { - "end": Object { - "column": 0, - "line": 11, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", }, - "start": Object { - "column": 0, - "line": 1, + 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": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 37, + ], + "type": "JSXText", + "value": "http://example.com", + }, + 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": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ">", }, - }, - "range": Array [ - 0, - 129, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, + "column": 44, "line": 1, }, "start": Object { - "column": 0, + "column": 43, "line": 1, }, }, "range": Array [ - 0, - 5, + 43, + 44, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 5, + "line": 3, }, "start": Object { - "column": 6, - "line": 1, + "column": 0, + "line": 3, }, }, "range": Array [ - 6, - 10, + 46, + 51, ], - "type": "Identifier", - "value": "pure", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { "column": 12, - "line": 1, + "line": 3, }, "start": Object { - "column": 11, - "line": 1, + "column": 6, + "line": 3, }, }, "range": Array [ - 11, - 12, + 52, + 58, ], - "type": "Punctuator", - "value": "=", + "type": "Identifier", + "value": "second", }, Object { "loc": Object { "end": Object { "column": 14, - "line": 1, + "line": 3, }, "start": Object { "column": 13, - "line": 1, + "line": 3, }, }, "range": Array [ - 13, - 14, + 59, + 60, ], "type": "Punctuator", - "value": "(", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 16, + "line": 3, }, "start": Object { - "column": 14, - "line": 1, + "column": 15, + "line": 3, }, }, "range": Array [ - 14, - 15, + 61, + 62, ], "type": "Punctuator", - "value": ")", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 17, + "line": 3, }, "start": Object { "column": 16, - "line": 1, + "line": 3, }, }, "range": Array [ - 16, - 18, + 62, + 63, ], "type": "Punctuator", - "value": "=>", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 35, + "line": 3, }, "start": Object { - "column": 19, - "line": 1, + "column": 17, + "line": 3, }, }, "range": Array [ - 19, - 20, + 63, + 81, ], - "type": "Punctuator", - "value": "{", + "type": "JSXText", + "value": "http://example.com", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 36, + "line": 3, }, "start": Object { - "column": 4, - "line": 2, + "column": 35, + "line": 3, }, }, "range": Array [ - 25, - 31, + 81, + 82, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 2, + "column": 37, + "line": 3, }, "start": Object { - "column": 11, - "line": 2, + "column": 36, + "line": 3, }, }, "range": Array [ - 32, - 33, + 82, + 83, ], "type": "Punctuator", - "value": "(", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 9, + "column": 38, "line": 3, }, "start": Object { - "column": 8, + "column": 37, "line": 3, }, }, "range": Array [ - 42, - 43, + 83, + 84, ], "type": "Punctuator", - "value": "<", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 12, + "column": 39, "line": 3, }, "start": Object { - "column": 9, + "column": 38, "line": 3, }, }, "range": Array [ - 43, - 46, + 84, + 85, ], - "type": "JSXIdentifier", - "value": "Foo", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 6, + "column": 5, + "line": 5, }, "start": Object { - "column": 8, - "line": 6, + "column": 0, + "line": 5, }, }, "range": Array [ - 102, - 103, + 87, + 92, ], - "type": "Punctuator", - "value": ">", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 7, + "column": 11, + "line": 5, }, "start": Object { - "column": 9, - "line": 6, + "column": 6, + "line": 5, }, }, "range": Array [ - 103, - 112, + 93, + 98, ], - "type": "JSXText", - "value": " - ", + "type": "Identifier", + "value": "third", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 7, + "column": 13, + "line": 5, }, "start": Object { - "column": 8, - "line": 7, + "column": 12, + "line": 5, }, }, "range": Array [ - 112, - 113, + 99, + 100, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 7, + "column": 15, + "line": 5, }, "start": Object { - "column": 9, - "line": 7, + "column": 14, + "line": 5, }, }, "range": Array [ - 113, - 114, + 101, + 102, ], "type": "Punctuator", - "value": "/", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 13, - "line": 7, + "column": 18, + "line": 5, }, "start": Object { - "column": 10, - "line": 7, + "column": 15, + "line": 5, }, }, "range": Array [ - 114, - 117, + 102, + 105, ], "type": "JSXIdentifier", - "value": "Foo", + "value": "div", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 7, + "column": 19, + "line": 5, }, "start": Object { - "column": 13, - "line": 7, + "column": 18, + "line": 5, }, }, "range": Array [ - 117, - 118, + 105, + 106, ], "type": "Punctuator", "value": ">", @@ -7323,566 +10047,359 @@ Object { Object { "loc": Object { "end": Object { - "column": 5, - "line": 8, + "column": 20, + "line": 5, }, "start": Object { - "column": 4, - "line": 8, + "column": 19, + "line": 5, }, }, "range": Array [ - 123, - 124, + 106, + 107, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 107, + 109, ], - "type": "Punctuator", - "value": ")", + "type": "JSXIdentifier", + "value": "br", }, Object { "loc": Object { "end": Object { - "column": 6, - "line": 8, + "column": 24, + "line": 5, }, "start": Object { - "column": 5, - "line": 8, + "column": 23, + "line": 5, }, }, "range": Array [ - 124, - 125, + 110, + 111, ], "type": "Punctuator", - "value": ";", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 25, + "line": 5, }, "start": Object { - "column": 0, - "line": 9, + "column": 24, + "line": 5, }, }, "range": Array [ - 126, - 127, + 111, + 112, ], "type": "Punctuator", - "value": "}", + "value": ">", }, - ], - "type": "Program", -} -`; - -exports[`Comments fixtures/jsx-text-with-multiline-non-comment.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "pure", - "range": Array [ - 6, - 10, - ], - "type": "Identifier", - }, - "init": Object { - "async": false, - "body": Object { - "body": Array [ - Object { - "argument": Object { - "children": Array [ - Object { - "loc": Object { - "end": Object { - "column": 4, - "line": 7, - }, - "start": Object { - "column": 9, - "line": 3, - }, - }, - "range": Array [ - 41, - 80, - ], - "raw": " - /** - * test - */ - ", - "type": "Literal", - "value": " - /** - * test - */ - ", - }, - ], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 7, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 9, - "line": 7, - }, - "start": Object { - "column": 6, - "line": 7, - }, - }, - "name": "Foo", - "range": Array [ - 82, - 85, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 80, - 86, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 10, - "line": 7, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "openingElement": Object { - "attributes": Array [], - "loc": Object { - "end": Object { - "column": 9, - "line": 3, - }, - "start": Object { - "column": 4, - "line": 3, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 8, - "line": 3, - }, - "start": Object { - "column": 5, - "line": 3, - }, - }, - "name": "Foo", - "range": Array [ - 37, - 40, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 36, - 41, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - }, - "range": Array [ - 36, - 86, - ], - "type": "JSXElement", - }, - "loc": Object { - "end": Object { - "column": 4, - "line": 8, - }, - "start": Object { - "column": 2, - "line": 2, - }, - }, - "range": Array [ - 23, - 91, - ], - "type": "ReturnStatement", - }, - ], - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 19, - "line": 1, - }, - }, - "range": Array [ - 19, - 93, - ], - "type": "BlockStatement", - }, - "expression": false, - "generator": false, - "id": null, - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 13, - "line": 1, - }, - }, - "params": Array [], - "range": Array [ - 13, - 93, - ], - "type": "ArrowFunctionExpression", - }, - "loc": Object { - "end": Object { - "column": 1, - "line": 9, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 93, - ], - "type": "VariableDeclarator", + "loc": Object { + "end": Object { + "column": 43, + "line": 5, }, + "start": Object { + "column": 25, + "line": 5, + }, + }, + "range": Array [ + 112, + 130, ], - "kind": "const", + "type": "JSXText", + "value": "http://example.com", + }, + Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 44, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 43, + "line": 5, }, }, "range": Array [ - 0, - 93, + 130, + 131, ], - "type": "VariableDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 10, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "Punctuator", + "value": "<", }, - }, - "range": Array [ - 0, - 94, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 45, + "line": 5, }, "start": Object { - "column": 0, - "line": 1, + "column": 44, + "line": 5, }, }, "range": Array [ - 0, - 5, + 131, + 132, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": "/", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 48, + "line": 5, }, "start": Object { - "column": 6, - "line": 1, + "column": 45, + "line": 5, }, }, "range": Array [ - 6, - 10, + 132, + 135, ], - "type": "Identifier", - "value": "pure", + "type": "JSXIdentifier", + "value": "div", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 49, + "line": 5, }, "start": Object { - "column": 11, - "line": 1, + "column": 48, + "line": 5, }, }, "range": Array [ - 11, - 12, + 135, + 136, ], "type": "Punctuator", - "value": "=", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 50, + "line": 5, }, "start": Object { - "column": 13, - "line": 1, + "column": 49, + "line": 5, }, }, "range": Array [ - 13, - 14, + 136, + 137, ], "type": "Punctuator", - "value": "(", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 5, + "line": 7, }, "start": Object { - "column": 14, - "line": 1, + "column": 0, + "line": 7, }, }, "range": Array [ - 14, - 15, + 139, + 144, ], - "type": "Punctuator", - "value": ")", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 18, - "line": 1, + "column": 12, + "line": 7, }, "start": Object { - "column": 16, - "line": 1, + "column": 6, + "line": 7, }, }, "range": Array [ - 16, - 18, + 145, + 151, ], - "type": "Punctuator", - "value": "=>", + "type": "Identifier", + "value": "fourth", }, Object { "loc": Object { "end": Object { - "column": 20, - "line": 1, + "column": 14, + "line": 7, }, "start": Object { - "column": 19, - "line": 1, + "column": 13, + "line": 7, }, }, "range": Array [ - 19, - 20, + 152, + 153, ], "type": "Punctuator", - "value": "{", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 2, + "column": 16, + "line": 7, }, "start": Object { - "column": 2, - "line": 2, + "column": 15, + "line": 7, }, }, "range": Array [ - 23, - 29, + 154, + 155, ], - "type": "Keyword", - "value": "return", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 2, + "column": 19, + "line": 7, }, "start": Object { - "column": 9, - "line": 2, + "column": 16, + "line": 7, }, }, "range": Array [ - 30, - 31, + 155, + 158, ], - "type": "Punctuator", - "value": "(", + "type": "JSXIdentifier", + "value": "div", }, Object { "loc": Object { "end": Object { - "column": 5, - "line": 3, + "column": 20, + "line": 7, }, "start": Object { - "column": 4, - "line": 3, + "column": 19, + "line": 7, }, }, "range": Array [ - 36, - 37, + 158, + 159, ], "type": "Punctuator", - "value": "<", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 8, - "line": 3, + "column": 21, + "line": 7, }, "start": Object { - "column": 5, - "line": 3, + "column": 20, + "line": 7, }, }, "range": Array [ - 37, - 40, + 159, + 160, ], - "type": "JSXIdentifier", - "value": "Foo", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 9, - "line": 3, + "column": 25, + "line": 7, }, "start": Object { - "column": 8, - "line": 3, + "column": 21, + "line": 7, }, }, "range": Array [ - 40, - 41, + 160, + 164, ], - "type": "Punctuator", - "value": ">", + "type": "JSXIdentifier", + "value": "span", }, Object { "loc": Object { "end": Object { - "column": 4, + "column": 26, "line": 7, }, "start": Object { - "column": 9, - "line": 3, + "column": 25, + "line": 7, }, }, "range": Array [ - 41, - 80, + 164, + 165, ], - "type": "JSXText", - "value": " - /** - * test - */ - ", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 5, + "column": 27, "line": 7, }, "start": Object { - "column": 4, + "column": 26, "line": 7, }, }, "range": Array [ - 80, - 81, + 165, + 166, ], "type": "Punctuator", "value": "<", @@ -7890,17 +10407,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 6, + "column": 28, "line": 7, }, "start": Object { - "column": 5, + "column": 27, "line": 7, }, }, "range": Array [ - 81, - 82, + 166, + 167, ], "type": "Punctuator", "value": "/", @@ -7908,35 +10425,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 9, + "column": 32, "line": 7, }, "start": Object { - "column": 6, + "column": 28, "line": 7, }, }, "range": Array [ - 82, - 85, + 167, + 171, ], "type": "JSXIdentifier", - "value": "Foo", + "value": "span", }, Object { "loc": Object { "end": Object { - "column": 10, + "column": 33, "line": 7, }, "start": Object { - "column": 9, + "column": 32, "line": 7, }, }, "range": Array [ - 85, - 86, + 171, + 172, ], "type": "Punctuator", "value": ">", @@ -7944,497 +10461,269 @@ Object { Object { "loc": Object { "end": Object { - "column": 3, - "line": 8, + "column": 51, + "line": 7, }, "start": Object { - "column": 2, - "line": 8, + "column": 33, + "line": 7, }, }, "range": Array [ - 89, - 90, + 172, + 190, ], - "type": "Punctuator", - "value": ")", + "type": "JSXText", + "value": "http://example.com", }, Object { "loc": Object { "end": Object { - "column": 4, - "line": 8, + "column": 52, + "line": 7, }, "start": Object { - "column": 3, - "line": 8, + "column": 51, + "line": 7, }, }, "range": Array [ - 90, - 91, + 190, + 191, ], "type": "Punctuator", - "value": ";", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 1, - "line": 9, + "column": 53, + "line": 7, }, "start": Object { - "column": 0, - "line": 9, + "column": 52, + "line": 7, }, }, "range": Array [ - 92, - 93, + 191, + 192, ], "type": "Punctuator", - "value": "}", + "value": "/", }, - ], - "type": "Program", -} -`; - -exports[`Comments fixtures/jsx-text-with-url.src 1`] = ` -Object { - "body": Array [ Object { - "declarations": Array [ - Object { - "id": Object { - "loc": Object { - "end": Object { - "column": 10, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "name": "link", - "range": Array [ - 6, - 10, - ], - "type": "Identifier", - }, - "init": Object { - "children": Array [ - Object { - "loc": Object { - "end": Object { - "column": 61, - "line": 1, - }, - "start": Object { - "column": 43, - "line": 1, - }, - }, - "range": Array [ - 43, - 61, - ], - "raw": "http://example.com", - "type": "Literal", - "value": "http://example.com", - }, - ], - "closingElement": Object { - "loc": Object { - "end": Object { - "column": 65, - "line": 1, - }, - "start": Object { - "column": 61, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 64, - "line": 1, - }, - "start": Object { - "column": 63, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 63, - 64, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 61, - 65, - ], - "type": "JSXClosingElement", - }, - "loc": Object { - "end": Object { - "column": 65, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "openingElement": Object { - "attributes": Array [ - Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 21, - "line": 1, - }, - "start": Object { - "column": 17, - "line": 1, - }, - }, - "name": "href", - "range": Array [ - 17, - 21, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 17, - 42, - ], - "type": "JSXAttribute", - "value": Object { - "loc": Object { - "end": Object { - "column": 42, - "line": 1, - }, - "start": Object { - "column": 22, - "line": 1, - }, - }, - "range": Array [ - 22, - 42, - ], - "raw": "\\"http://example.com\\"", - "type": "Literal", - "value": "http://example.com", - }, - }, - ], - "loc": Object { - "end": Object { - "column": 43, - "line": 1, - }, - "start": Object { - "column": 14, - "line": 1, - }, - }, - "name": Object { - "loc": Object { - "end": Object { - "column": 16, - "line": 1, - }, - "start": Object { - "column": 15, - "line": 1, - }, - }, - "name": "a", - "range": Array [ - 15, - 16, - ], - "type": "JSXIdentifier", - }, - "range": Array [ - 14, - 43, - ], - "selfClosing": false, - "type": "JSXOpeningElement", - }, - "range": Array [ - 14, - 65, - ], - "type": "JSXElement", - }, - "loc": Object { - "end": Object { - "column": 66, - "line": 1, - }, - "start": Object { - "column": 6, - "line": 1, - }, - }, - "range": Array [ - 6, - 66, - ], - "type": "VariableDeclarator", - }, - ], - "kind": "const", "loc": Object { "end": Object { - "column": 67, - "line": 1, + "column": 56, + "line": 7, }, "start": Object { - "column": 0, - "line": 1, + "column": 53, + "line": 7, }, }, "range": Array [ - 0, - 67, + 192, + 195, ], - "type": "VariableDeclaration", - }, - ], - "comments": Array [], - "loc": Object { - "end": Object { - "column": 0, - "line": 2, - }, - "start": Object { - "column": 0, - "line": 1, + "type": "JSXIdentifier", + "value": "div", }, - }, - "range": Array [ - 0, - 68, - ], - "sourceType": "script", - "tokens": Array [ Object { "loc": Object { "end": Object { - "column": 5, - "line": 1, + "column": 57, + "line": 7, }, "start": Object { - "column": 0, - "line": 1, + "column": 56, + "line": 7, }, }, "range": Array [ - 0, - 5, + 195, + 196, ], - "type": "Keyword", - "value": "const", + "type": "Punctuator", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 10, - "line": 1, + "column": 58, + "line": 7, }, "start": Object { - "column": 6, - "line": 1, + "column": 57, + "line": 7, }, }, "range": Array [ - 6, - 10, + 196, + 197, ], - "type": "Identifier", - "value": "link", + "type": "Punctuator", + "value": ";", }, Object { "loc": Object { "end": Object { - "column": 12, - "line": 1, + "column": 5, + "line": 9, }, "start": Object { - "column": 11, - "line": 1, + "column": 0, + "line": 9, }, }, "range": Array [ - 11, - 12, + 199, + 204, ], - "type": "Punctuator", - "value": "=", + "type": "Keyword", + "value": "const", }, Object { "loc": Object { "end": Object { - "column": 14, - "line": 1, + "column": 11, + "line": 9, }, "start": Object { - "column": 13, - "line": 1, + "column": 6, + "line": 9, }, }, "range": Array [ - 13, - 14, + 205, + 210, ], - "type": "Punctuator", - "value": "(", + "type": "Identifier", + "value": "fifth", }, Object { "loc": Object { "end": Object { - "column": 15, - "line": 1, + "column": 13, + "line": 9, }, "start": Object { - "column": 14, - "line": 1, + "column": 12, + "line": 9, }, }, "range": Array [ - 14, - 15, + 211, + 212, ], "type": "Punctuator", - "value": "<", + "value": "=", }, Object { "loc": Object { "end": Object { - "column": 16, - "line": 1, + "column": 15, + "line": 9, }, "start": Object { - "column": 15, - "line": 1, + "column": 14, + "line": 9, }, }, "range": Array [ - 15, - 16, + 213, + 214, ], - "type": "JSXIdentifier", - "value": "a", + "type": "Punctuator", + "value": "<", }, Object { "loc": Object { "end": Object { - "column": 21, - "line": 1, + "column": 18, + "line": 9, }, "start": Object { - "column": 17, - "line": 1, + "column": 15, + "line": 9, }, }, "range": Array [ - 17, - 21, + 214, + 217, ], "type": "JSXIdentifier", - "value": "href", + "value": "div", }, Object { "loc": Object { "end": Object { - "column": 22, - "line": 1, + "column": 19, + "line": 9, }, "start": Object { - "column": 21, - "line": 1, + "column": 18, + "line": 9, }, }, "range": Array [ - 21, - 22, + 217, + 218, ], "type": "Punctuator", - "value": "=", + "value": ">", }, Object { "loc": Object { "end": Object { - "column": 42, - "line": 1, + "column": 20, + "line": 9, }, "start": Object { - "column": 22, - "line": 1, + "column": 19, + "line": 9, }, }, "range": Array [ - 22, - 42, + 218, + 219, ], - "type": "JSXText", - "value": "\\"http://example.com\\"", + "type": "Punctuator", + "value": "{", }, Object { "loc": Object { "end": Object { - "column": 43, - "line": 1, + "column": 21, + "line": 9, }, "start": Object { - "column": 42, - "line": 1, + "column": 20, + "line": 9, }, }, "range": Array [ - 42, - 43, + 219, + 220, ], "type": "Punctuator", - "value": ">", + "value": "}", }, Object { "loc": Object { "end": Object { - "column": 61, - "line": 1, + "column": 39, + "line": 9, }, "start": Object { - "column": 43, - "line": 1, + "column": 21, + "line": 9, }, }, "range": Array [ - 43, - 61, + 220, + 238, ], "type": "JSXText", "value": "http://example.com", @@ -8442,17 +10731,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 62, - "line": 1, + "column": 40, + "line": 9, }, "start": Object { - "column": 61, - "line": 1, + "column": 39, + "line": 9, }, }, "range": Array [ - 61, - 62, + 238, + 239, ], "type": "Punctuator", "value": "<", @@ -8460,17 +10749,17 @@ Object { Object { "loc": Object { "end": Object { - "column": 63, - "line": 1, + "column": 41, + "line": 9, }, "start": Object { - "column": 62, - "line": 1, + "column": 40, + "line": 9, }, }, "range": Array [ - 62, - 63, + 239, + 240, ], "type": "Punctuator", "value": "/", @@ -8478,35 +10767,35 @@ Object { Object { "loc": Object { "end": Object { - "column": 64, - "line": 1, + "column": 44, + "line": 9, }, "start": Object { - "column": 63, - "line": 1, + "column": 41, + "line": 9, }, }, "range": Array [ - 63, - 64, + 240, + 243, ], "type": "JSXIdentifier", - "value": "a", + "value": "div", }, Object { "loc": Object { "end": Object { - "column": 65, - "line": 1, + "column": 45, + "line": 9, }, "start": Object { - "column": 64, - "line": 1, + "column": 44, + "line": 9, }, }, "range": Array [ - 64, - 65, + 243, + 244, ], "type": "Punctuator", "value": ">", @@ -8514,35 +10803,17 @@ Object { 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": 67, - "line": 1, + "column": 46, + "line": 9, }, "start": Object { - "column": 66, - "line": 1, + "column": 45, + "line": 9, }, }, "range": Array [ - 66, - 67, + 244, + 245, ], "type": "Punctuator", "value": ";", diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap index de734d08383..227932cd936 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.ts.snap @@ -8,6 +8,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsdoc-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-attr-and-text-with-url.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-block-comment.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/comments/jsx-comment-after-jsx.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`;