Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

New: Create option to enable JSXText node type (fixes #266) #272

Merged
merged 1 commit into from
May 21, 2017

Conversation

soda0289
Copy link
Member

This commit creates a new parser config option useJSXTextNode that enables JSXText node type instead of Literal for strings inside of JSXElement nodes. The default is false as currently many eslint rules depend on the Literal node type.

I have moved the JSX tests into its own directory and created a new test runner that can run tests for JSX files with and without the useJSXTextNode flag enabled.

@eslintbot
Copy link

LGTM

tests/lib/jsx.js Outdated
"jsx/namespaced-attribute-and-value-inserted", // https://github.com/Microsoft/TypeScript/issues/7411
"jsx/namespaced-name-and-attribute", // https://github.com/Microsoft/TypeScript/issues/7411
"jsx/invalid-namespace-value-with-dots", // https://github.com/Microsoft/TypeScript/issues/7411
"jsx/multiple-blank-spaces" // Fixed by #271
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was fixed, why has it been re-added as one to skip?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once I rebase this change I can remove it.

lib/convert.js Outdated
@@ -1613,9 +1613,12 @@ module.exports = function convert(config) {

}

case SyntaxKind.JsxText:
case SyntaxKind.JsxText: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you document inline why we are doing this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. It is only temporary until eslint v5, will make a note.

@soda0289 soda0289 force-pushed the use-jsxtext-node branch from 9be81da to 852eafc Compare May 19, 2017 01:38
@eslintbot
Copy link

LGTM

@soda0289
Copy link
Member Author

@JamesHenry Changes made. Thanks for the review

@JamesHenry
Copy link
Member

Ah, I just merged the other JSXText PR, so this will need rebasing. Once that's done this is good to go, and I can see it has already been verified in prettier.

@soda0289 soda0289 force-pushed the use-jsxtext-node branch from 852eafc to 76bef55 Compare May 21, 2017 19:31
@eslintbot
Copy link

LGTM

@soda0289
Copy link
Member Author

@JamesHenry Rebased. Should be good to go in.

@JamesHenry JamesHenry merged commit b7220fd into master May 21, 2017
@JamesHenry JamesHenry deleted the use-jsxtext-node branch May 21, 2017 20:21
josephfrazier added a commit to josephfrazier/prettier that referenced this pull request May 21, 2017
…strings inside JSXElement

eslint/typescript-eslint-parser#272 was merged,
so this fixes prettier#1558

See here for more info about the new TSQualifiedName node type:
eslint/typescript-eslint-parser@3491b4b
vjeux pushed a commit to prettier/prettier that referenced this pull request May 21, 2017
* Run `yarn` to update yarn.lock

* Upgrade typescript-eslint-parser, use JSXText instead of Literal for strings inside JSXElement

eslint/typescript-eslint-parser#272 was merged,
so this fixes #1558

See here for more info about the new TSQualifiedName node type:
eslint/typescript-eslint-parser@3491b4b

* Run AST comparison tests on Travis
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants