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

Suppressions for react-no-dangerous-html require absolute path #537

Closed
kevinwilde opened this issue Oct 9, 2018 · 2 comments
Closed

Suppressions for react-no-dangerous-html require absolute path #537

kevinwilde opened this issue Oct 9, 2018 · 2 comments
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs Type: Bug
Milestone

Comments

@kevinwilde
Copy link
Contributor

Suppressions for react-no-dangerous-html only work when the file attribute contains the absolute path to the file.

I believe the problem is line 120 in src/reactNoDangerousHtmlRule.ts when the file attribute is compared for equality to a SourceFile.fileName which is an absolute path.

@JoshuaKGoldberg
Copy link

Agreed, and thanks for reporting this!

https://github.com/Microsoft/tslint-microsoft-contrib/blob/7e87ab24758fef21611d13091e74c55c4fc70a4e/src/reactNoDangerousHtmlRule.ts#L120

Should be a relatively simpler bug fix to switch that logic to checking if the paths generally match up. /foo/bar/baz.tsx should match with C:/Code/Project/foobar/baz.tsx.

@JoshuaKGoldberg JoshuaKGoldberg added Type: Bug Status: Accepting PRs Good First Issue 🙌 Howdy, neighbor! Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Hacktoberfest labels Oct 9, 2018
@kevinwilde
Copy link
Contributor Author

I can work on this. I'm thinking it could be changed to

path.resolve(exception.file) === this.getSourceFile().fileName

https://nodejs.org/api/path.html#path_path_resolve_paths

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Difficulty: Easy Someone with little to no experience in TSLint should be able to send a pull request for this issue. Good First Issue 🙌 Howdy, neighbor! Status: Accepting PRs Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants