Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Handle relative paths in exceptions for react-no-dangerous-html rule #539

Conversation

kevinwilde
Copy link
Contributor

Fixes #537

@msftclas
Copy link

msftclas commented Oct 9, 2018

CLA assistant check
All CLA requirements met.

@kevinwilde
Copy link
Contributor Author

Ah shoot. I guess SourceFile.fileName uses / on Windows, but path.resolve(..) uses \\. Need to fix the tests

@kevinwilde kevinwilde force-pushed the react-no-dangerous-html-exception-relative-path branch from 2005799 to 8b01053 Compare October 10, 2018 19:36
} else {
filename = 'file.ts';
filename = Utils.absolutePath('file.ts');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests previously just used 'file.ts(x)' as a mock filename. Since reactNoDangerousHtmlRule now compares Utils.absolutePath(exception.file) to this.getSourceFile().fileName (which also returns an absolute path when running tslint on an actual project) we need the tests to provide an absolute path for the filename, as well.

Unfortunately, this means I had to change a lot of test files, so this PR has a lot of line changes.

@kevinwilde kevinwilde force-pushed the react-no-dangerous-html-exception-relative-path branch from 8b01053 to d0ad9d7 Compare October 10, 2018 19:58
Copy link

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

What a large PR for such a small source change...! Thanks @kevinwilde! 🙌

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