{"id":26660638,"url":"https://github.com/codevideo/syntax-spy","last_synced_at":"2025-03-25T12:18:53.096Z","repository":{"id":227465869,"uuid":"767764749","full_name":"codevideo/syntax-spy","owner":"codevideo","description":"Simultaneously detect and syntax check any code snippet with ease.","archived":false,"fork":false,"pushed_at":"2024-03-17T09:33:53.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-03-17T10:39:08.087Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codevideo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-05T21:26:07.000Z","updated_at":"2024-03-05T21:32:16.000Z","dependencies_parsed_at":"2024-03-17T10:33:58.162Z","dependency_job_id":"34a1bf17-d11a-4529-bc79-26e4526762c8","html_url":"https://github.com/codevideo/syntax-spy","commit_stats":null,"previous_names":["codevideo/syntax-spy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codevideo%2Fsyntax-spy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codevideo%2Fsyntax-spy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codevideo%2Fsyntax-spy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codevideo%2Fsyntax-spy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codevideo","download_url":"https://codeload.github.com/codevideo/syntax-spy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245458711,"owners_count":20618697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-25T12:18:52.068Z","updated_at":"2025-03-25T12:18:52.966Z","avatar_url":"https://github.com/codevideo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# syntax-spy\n\nSimultaneously detect and syntax check any code snippet with ease.\n\n`syntax-spy` is a powerful TypeScript / JavaScript tool that combines the powers of [vscode-languagedetection\n](https://github.com/microsoft/vscode-languagedetection), [ts-morph](https://github.com/dsherret/ts-morph), and a variety of other AST and linting tools to simultaneously identify and syntax check any snippet of code.\n\n## Installation\n\n```bash\nnpm install @fullstackcraftllc/syntax-spy\n```\n\n## Usage\n\n```typescript\nimport { identifyAndValidateCode } from '@fullstackcraftllc/syntax-spy';\n\nconst code = `\n// here's a comment in TypeScript\nconst testFunction = (someParam: string) =\u003e {\n    const myStringArray: string[] = ['Hello', 'World'];\n    console.log(someParam); \n    blahblahsomesyntaxerror\n}\n`;\n\nasync function main() {\n    try {\n        const { language, isValid, error } = await identifyAndValidateCode(code);\n        if (error) {\n            console.error('Error:', error);\n        } else {\n            console.log('Detected language:', language);\n            console.log('Syntax is valid:', isValid);\n        }\n    } catch (error) {\n        console.error('Error:', error);\n    }\n}\n\nmain();\n```\n\n## TODOs\n\n- Add support for more programming languages.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodevideo%2Fsyntax-spy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodevideo%2Fsyntax-spy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodevideo%2Fsyntax-spy/lists"}