{"id":16590653,"url":"https://github.com/oliviertassinari/babel-plugin-react-remove-properties","last_synced_at":"2025-04-12T09:28:16.949Z","repository":{"id":60774999,"uuid":"44477835","full_name":"oliviertassinari/babel-plugin-react-remove-properties","owner":"oliviertassinari","description":"Babel plugin for removing React properties. :dash:","archived":false,"fork":false,"pushed_at":"2019-03-15T00:33:20.000Z","size":43,"stargazers_count":379,"open_issues_count":0,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T21:50:09.307Z","etag":null,"topics":["babel","babel-plugin","minification","properties","react"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/oliviertassinari.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-18T12:48:25.000Z","updated_at":"2024-09-30T03:43:23.000Z","dependencies_parsed_at":"2022-10-04T16:16:28.513Z","dependency_job_id":null,"html_url":"https://github.com/oliviertassinari/babel-plugin-react-remove-properties","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliviertassinari%2Fbabel-plugin-react-remove-properties","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliviertassinari%2Fbabel-plugin-react-remove-properties/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliviertassinari%2Fbabel-plugin-react-remove-properties/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oliviertassinari%2Fbabel-plugin-react-remove-properties/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oliviertassinari","download_url":"https://codeload.github.com/oliviertassinari/babel-plugin-react-remove-properties/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248545601,"owners_count":21122170,"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":["babel","babel-plugin","minification","properties","react"],"created_at":"2024-10-11T23:13:52.226Z","updated_at":"2025-04-12T09:28:16.909Z","avatar_url":"https://github.com/oliviertassinari.png","language":"JavaScript","readme":"# babel-plugin-react-remove-properties\n\n\u003e Babel plugin for removing React properties.\n\n[![npm version](https://img.shields.io/npm/v/babel-plugin-react-remove-properties.svg?style=flat-square)](https://www.npmjs.com/package/babel-plugin-react-remove-properties)\n[![npm downloads](https://img.shields.io/npm/dm/babel-plugin-react-remove-properties.svg?style=flat-square)](https://www.npmjs.com/package/babel-plugin-react-remove-properties)\n[![Build Status](https://travis-ci.org/oliviertassinari/babel-plugin-react-remove-properties.svg?branch=master)](https://travis-ci.org/oliviertassinari/babel-plugin-react-remove-properties)\n\n[![Dependencies](https://img.shields.io/david/oliviertassinari/babel-plugin-react-remove-properties.svg?style=flat-square)](https://david-dm.org/oliviertassinari/babel-plugin-react-remove-properties)\n[![DevDependencies](https://img.shields.io/david/dev/oliviertassinari/babel-plugin-react-remove-properties.svg?style=flat-square)](https://david-dm.org/oliviertassinari/babel-plugin-react-remove-properties#info=devDependencies\u0026view=list)\n\n## Installation\n\n```sh\nnpm install --save-dev babel-plugin-react-remove-properties\n```\n\n## The problem solved\n\nThis is useful when using selectors like data-test to run selenium test. Those properties are useless when running the code in production. You can **save bandwidth** by removing them.\n\n## Example\n\n**In**\n```js\nclass Foo extends React.Component {\n  render() {\n    return (\n      \u003cdiv className=\"bar\" data-test=\"thisIsASelectorForSelenium\"\u003e\n        Hello Wold!\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n**Out**\n```js\nclass Foo extends React.Component {\n  render() {\n    return (\n      \u003cdiv className=\"bar\"\u003e\n        Hello Wold!\n      \u003c/div\u003e\n    );\n  }\n}\n```\n\n## Usage\n\n#### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\nwithout options:\n```json\n{\n  \"env\": {\n    \"production\": {\n      \"plugins\": [\n        \"react-remove-properties\"\n      ]\n    }\n  }\n}\n```\n\nwith options. We accepts an array of property names that can be either strings or regular expressions:\n```json\n{\n  \"env\": {\n    \"production\": {\n      \"plugins\": [\n        [\"react-remove-properties\", {\"properties\": [\"data-test\", \"data-foo\", /my-suffix-expression$/]}]\n      ]\n    }\n  }\n}\n```\n\n#### Via CLI\n\n```sh\nbabel --plugins react-remove-properties script.js\n```\n\n#### Via Node API\n\nwithout options:\n```js\nrequire('babel-core').transform('code', {\n  plugins: [\n    'react-remove-properties',\n  ],\n});\n```\n\nwith options:\n```js\nrequire('babel-core').transform('code', {\n  plugins: [\n    ['react-remove-properties', {properties: ['data-test', 'data-foo', /my-suffix-expression$/]}],\n  ],\n});\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliviertassinari%2Fbabel-plugin-react-remove-properties","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foliviertassinari%2Fbabel-plugin-react-remove-properties","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foliviertassinari%2Fbabel-plugin-react-remove-properties/lists"}