Better Code Search with Flashlight

Earlier last year, I created a tool called Flashlight which is a Rust-powered JavaScript code search tool. I recently added support for searching for JSX tags and I’d like to highlight the features of Flashlight briefly.

In a nutshell, Flashlight allows you to search for various pieces of code (currently only imports and JSX tags) in a way that traditional editor search would have difficulty doing. For example, if you want to find all imports from react where useState was imported, you could run the following command.

flashlight imports react useState

You could do this with search in your editor, but when imports span multiple lines, this get’s a bit tougher.

But it’s not just imports, you can also search for JSX tags! When using tag search, you can search by tag, attribute, and value for a very granular search experience!

flashlight tags Button
flashlight tags Button variant
flashlight tags Button variant=primary

Again, some of these searches would be very difficult to do with traditional editor search, but because Flashlight is analyzing the code structure, it is able to very easily answer these types of queries.

To start using Flashlight today, run the installation command in your shell of choice. Flashlight comes with shell completions for bash, zsh, and fish so you can hit the ground running!

curl -LSfs https://mskelton.dev/flashlight/install | sh