Style only certain files in tree view


#1

I wrote a package to detect orphan files (unimported) in a javascript project. That is done and now I decided to create an atom plugin to highlight those files but I am finding issues.

I can find the elements via DOM queries, since I have their path, and then I can change the style. However, several events recreate those elements, like folder expand/collapse, so any change to style, or any class added get lost.

What is the correct approach for styling only certain files?


#2

Answered in Slack, but I figured I should update here too …

You should be using an event-based approach. So any time a new file gets displayed or the orphan status of a file changes, you should add or remove a class indicating the file’s orphan status.