Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore first level jsx AST and tokens #394

Merged
merged 4 commits into from
May 14, 2022
Merged

Conversation

JounQin
Copy link
Member

@JounQin JounQin commented May 14, 2022

close #384

@JounQin JounQin added 🐛 type/bug This is a problem 🦋 type/enhancement This is great to have 👶 semver/patch This is a backwards-compatible fix labels May 14, 2022
@JounQin JounQin self-assigned this May 14, 2022
@codesandbox-ci
Copy link

codesandbox-ci bot commented May 14, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@codecov-commenter
Copy link

codecov-commenter commented May 14, 2022

Codecov Report

Merging #394 (46fd62d) into master (7e59d5e) will increase coverage by 0.92%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           master      #394      +/-   ##
===========================================
+ Coverage   99.07%   100.00%   +0.92%     
===========================================
  Files          17        16       -1     
  Lines         217       195      -22     
  Branches       45        38       -7     
===========================================
- Hits          215       195      -20     
+ Misses          1         0       -1     
+ Partials        1         0       -1     
Impacted Files Coverage Δ
packages/eslint-mdx/src/index.ts 100.00% <ø> (ø)
packages/eslint-mdx/src/helpers.ts 100.00% <100.00%> (+3.57%) ⬆️
packages/eslint-mdx/src/parser.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e59d5e...46fd62d. Read the comment docs.


const processed = new WeakSet<Node>()

// TODO: merge with `tokens.ts`
Copy link
Member Author

Choose a reason for hiding this comment

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

Will refactor later

@JounQin
Copy link
Member Author

JounQin commented May 14, 2022

@wooorm Any time to review and draft a next release? I think it's very close to stable release for v2 now.

Copy link
Member

@wooorm wooorm left a comment

Choose a reason for hiding this comment

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

If this token generation works, 👍!
Might be useful to have more tests of valid JavaScript inside MDX content?

packages/eslint-mdx/src/types.ts Outdated Show resolved Hide resolved
packages/eslint-mdx/src/tokens.ts Show resolved Hide resolved
@@ -181,6 +141,82 @@ export const requirePkg = async <T>(
throw error
}

/* istanbul ignore next -- used in worker */
export const getPositionAt = (text: string, offset: number): Position => {
Copy link
Member

Choose a reason for hiding this comment

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

vfile-location might be useful here?

Copy link
Member Author

@JounQin JounQin May 14, 2022

Choose a reason for hiding this comment

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

Maybe in next development schedule. I'm a bit tired today. 😂

This package is ESM only, to use it I need to do some refactor.

Copy link
Member

Choose a reason for hiding this comment

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

You could use the previous version, but also fine without!

@JounQin
Copy link
Member Author

JounQin commented May 14, 2022

If this token generation works, 👍! Might be useful to have more tests of valid JavaScript inside MDX content?

There are a lot of fixtures, maybe you can propose some test cases here?

@wooorm
Copy link
Member

wooorm commented May 14, 2022

Yeah I was still thinking about more. Specifically MDX 2 things, mentioned in the blog post and the migration guide.
Troubleshooting might be useful too: how to deal with syntax errors.
You could also take some things from the micromark-extension-mdx*/mdast-util-mdx/remark-mdx packages? 🤔

@wooorm
Copy link
Member

wooorm commented May 14, 2022

I think this is good now? Or am I missing something?

@JounQin
Copy link
Member Author

JounQin commented May 14, 2022

I think this is good now? Or am I missing something?

Then I'm going to merge.

@JounQin JounQin mentioned this pull request May 14, 2022
4 tasks
@JounQin
Copy link
Member Author

JounQin commented May 14, 2022

Yeah I was still thinking about more. Specifically MDX 2 things, mentioned in the blog post and the migration guide. Troubleshooting might be useful too: how to deal with syntax errors. You could also take some things from the micromark-extension-mdx*/mdast-util-mdx/remark-mdx packages? 🤔

Drafted #395 to track.

@JounQin JounQin merged commit 35d2fe2 into master May 14, 2022
@JounQin JounQin deleted the fix/missing_ast_tokens branch May 14, 2022 15:01
@JounQin
Copy link
Member Author

JounQin commented May 14, 2022

Ready for a new next release then. 🍺

@wooorm
Copy link
Member

wooorm commented May 14, 2022

Released!

P.S.:

> @mdx-js/eslint@0.0.0 prepare /Users/tilde/Projects/oss/eslint-mdx
> patch-package && simple-git-hooks && yarn-deduplicate --strategy fewer || exit 0

patch-package 6.4.7
Applying patches...
No patch files found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👶 semver/patch This is a backwards-compatible fix 🐛 type/bug This is a problem 🦋 type/enhancement This is great to have
Development

Successfully merging this pull request may close these issues.

[v2] no-unused-expressions in jsx content
4 participants