GoogleChrome / GoogleChrome/webstatus.dev

[ENHANCEMENT] Perform client side validation of search query

Open
#717 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue hacktoberfest typescript
Dominant language
Go
Stars
254
Forks
62
Avg merge
1d 10h
Merged PRs (30d)
64

Description

Builds on #716

**Is your feature request related to a problem? Please describe.**
Currently, we send the request to the backend and wait for it to return a 4xx error if it is a bad query. Instead, we can do that locally with the ANTLR grammar. (And potentially get even more information). This change uses the work in #716 to use the generated parser and lexer to check the input

**Describe the solution you'd like**
- Import the generated parser and lexer from #716
- Check these docs on using the lexer and parser [[1](https://github.com/antlr/antlr4/blob/master/doc/typescript-target.md#how-do-i-run-the-generated-lexer-andor-parser)] and example validation [[2](https://github.com/antlr/antlr4/blob/master/doc/ace-javascript-target.md)] (check the validate method at the bottom)
- Use the validate [method](https://github.com/GoogleChrome/webstatus.dev/blob/3e2268ec1ec73809c6cf74236fdfafe7bffa635b/frontend/src/static/js/components/webstatus-overview-filters.ts#L228-L234) before we redirect the browser
- Show errors in a toast.
- Add unit tests and playwright tests to assert this.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.