Skip to content

Commit 89d6689

Browse files
[API] Deprecate the property option (#10)
1 parent 343a97a commit 89d6689

3 files changed

Lines changed: 11 additions & 16 deletions

File tree

README.md

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Foo extends React.Component {
5353

5454
**.babelrc**
5555

56-
without options
56+
without options:
5757
```json
5858
{
5959
"env": {
@@ -64,18 +64,7 @@ without options
6464
}
6565
```
6666

67-
with options
68-
```json
69-
{
70-
"env": {
71-
"production": {
72-
"plugins": ["react-remove-properties", {"property": "data-test"}]
73-
}
74-
}
75-
}
76-
```
77-
78-
the options also accepts an array of property names
67+
with options. We accepts an array of property names:
7968

8069
```json
8170
{

src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ export default function() {
66
const properties = state.opts.properties || [];
77

88
if (state.opts.property) {
9+
/* eslint-disable no-console */
10+
console.warn(`
11+
babel-plugin-react-remove-properties:
12+
The property option is deprecated, instead use the properties one.
13+
`);
14+
/* eslint-enable no-console */
915
properties.push(state.opts.property);
1016
}
1117

test/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ function getPluginOptionsForDirectory(directory, filename = 'options.json') {
1818
}
1919
}
2020

21-
describe('remove react propTypes', () => {
21+
describe('remove react properties', () => {
2222
const fixturesDir = path.join(__dirname, 'fixtures');
2323
fs.readdirSync(fixturesDir).map((caseName) => {
24-
it(`should ${caseName.split('-').join(' ')}`, () => {
24+
it(`should work with ${caseName.split('-').join(' ')}`, () => {
2525
const fixtureDir = path.join(fixturesDir, caseName);
2626
const pluginOptions = getPluginOptionsForDirectory(fixtureDir);
2727
const actual = transformFileSync(path.join(fixtureDir, 'actual.js'), {
@@ -31,7 +31,7 @@ describe('remove react propTypes', () => {
3131
}).code;
3232
const expected = fs.readFileSync(path.join(fixtureDir, 'expected.js')).toString();
3333

34-
assert.equal(trim(actual), trim(expected));
34+
assert.strictEqual(trim(actual), trim(expected));
3535
});
3636
});
3737
});

0 commit comments

Comments
 (0)