Skip to content

Silence some wrong unsafe-member-access errors #88

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

Merged
merged 5 commits into from
Feb 25, 2021

Conversation

dummdidumm
Copy link
Member

Fixes #87
.. but not all possible cases, see README.

Fixes sveltejs#87
.. but not all possible cases, see README.
@@ -209,14 +226,10 @@ const ts_import_transformer = (context) => {
// 5. parse the source to get the AST
// 6. return AST of step 5, warnings and vars of step 2
function compile_code(text, compiler, processor_options) {
Copy link
Member Author

Choose a reason for hiding this comment

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

I refactored the code for readability, functionality stayed the same.

Simon Holthausen added 2 commits February 18, 2021 16:58
Copy link

@hWorblehat hWorblehat left a comment

Choose a reason for hiding this comment

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

As the reporter of #87, I thought I'd take a look. To my untrained eye, the fix looks like it should work, and the additional test sample should cover it.

Just a couple of comments...

@hWorblehat
Copy link

I can see this change works by effectively splicing the script blocks into the code being analysed, thereby ensuring all declarations are present as they were originally written.

I haven't looked in too much detail at how this plugin works, but is there a chance that with this change, if there is an ESLint warning in (say) the module context block, then it will be double-reported due to the module context being spliced into other blocks?

@dummdidumm
Copy link
Member Author

It will not (and the test confirms that) because eslint warnings/errors on unmapped code will be ignored.

@hWorblehat
Copy link

Well I'm happy then, but presumably my approval isn't very useful in terms of getting this merged...

@Conduitry Conduitry merged commit 5f2e749 into sveltejs:master Feb 25, 2021
@dummdidumm dummdidumm deleted the fix-some-unsafe branch February 25, 2021 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript type-aware checks don't work in template expressions or cross-context
3 participants