{"id":15021402,"url":"https://github.com/x-kom/babel-plugin-react-component-trace-data-attr","last_synced_at":"2026-03-05T21:03:11.479Z","repository":{"id":52032740,"uuid":"169575295","full_name":"x-kom/babel-plugin-react-component-trace-data-attr","owner":"x-kom","description":"Adds data- attribute to html elements showing the trace of components names that led to this element creation.","archived":false,"fork":false,"pushed_at":"2022-12-02T22:24:33.000Z","size":76,"stargazers_count":0,"open_issues_count":4,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-03T08:50:29.623Z","etag":null,"topics":["babel-plugin","data-attributes","react","testing"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/x-kom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-07T13:23:31.000Z","updated_at":"2019-12-03T17:31:57.000Z","dependencies_parsed_at":"2023-01-22T23:00:56.710Z","dependency_job_id":null,"html_url":"https://github.com/x-kom/babel-plugin-react-component-trace-data-attr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/x-kom/babel-plugin-react-component-trace-data-attr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-kom%2Fbabel-plugin-react-component-trace-data-attr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-kom%2Fbabel-plugin-react-component-trace-data-attr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-kom%2Fbabel-plugin-react-component-trace-data-attr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-kom%2Fbabel-plugin-react-component-trace-data-attr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x-kom","download_url":"https://codeload.github.com/x-kom/babel-plugin-react-component-trace-data-attr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-kom%2Fbabel-plugin-react-component-trace-data-attr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30149940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T16:58:46.102Z","status":"ssl_error","status_checked_at":"2026-03-05T16:58:45.706Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["babel-plugin","data-attributes","react","testing"],"created_at":"2024-09-24T19:56:32.318Z","updated_at":"2026-03-05T21:03:11.450Z","avatar_url":"https://github.com/x-kom.png","language":"JavaScript","readme":"# babel-plugin-react-component-trace-data-attr\nAdds `data-component-trace` attribute to html elements showing the trace of React components names that led to this element creation.\n\n\u003e Note: it will only work with JSX elements, not with `React.createElement`. If you're using TypeScript and transpile it separately, use `\"jsx\": \"preserve\"` in your `tsconfig.json` and add `preset-react` to your babel presets.\n\nUseful when combined with [component-trace-element-finder](https://www.npmjs.com/package/component-trace-element-finder)\n\n## Example\nConsidering components structure:\n```jsx\nconst HeaderOfComponent = () =\u003e \u003ch1 /\u003e;\nconst ContentOfComponent = () =\u003e \u003cdiv /\u003e;\nconst SecondComponent = () =\u003e \u003c\u003e\u003cHeaderOfComponent /\u003e\u003cContentOfComponent /\u003e\u003c/\u003e;\nconst Component = () =\u003e \u003cSecondComponent /\u003e;\n\nrender(\u003cComponent /\u003e);\n```\n\nResulting HTML markup will look like this:\n```html\n\u003ch1 data-component-trace=\" component second-component header-of-component\"\u003e\u003c/h1\u003e\n\u003cdiv data-component-trace=\" component second-component content-of-component\"\u003e\u003c/div\u003e\n```\nwhere components names are separated by a single space\n\n## Options:\n- **`attribute`** - any attribute name you want, should begin from `data-`. Default: `data-component-trace`.\n- **`format`** - can be \"camel\" (camelCase), \"snake\" (snake_case) or \"kebab\" (kebab-case). Default: `kebab`.\n- **`separator`** - can by any non-empty string. Default: ` ` (single space, useful for selectors like `[data-component-trace~=second-component]`).\n\nExample:\n```json\n  [\"react-component-trace-data-attr\", {\n    \"attribute\": \"data-component-trace\",\n    \"format\": \"kebab\",\n    \"separator\": \" \",\n  }]\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-kom%2Fbabel-plugin-react-component-trace-data-attr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx-kom%2Fbabel-plugin-react-component-trace-data-attr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-kom%2Fbabel-plugin-react-component-trace-data-attr/lists"}