Skip to content

Conversation

burabure
Copy link
Contributor

@burabure burabure commented Nov 1, 2016

Adds a forbidPatterns option that takes an array of regexp strings so it's possible to forbid the use of things like data-* props

Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of forbidPatterns. I very much dislike the idea of feeding the string into RegExp.

Adds a forbidPatterns option that takes an array
of safe pattern strings so it's possible to forbid the use
of things like "data-*" props.
Also adds the ignoreDomNodes option (defaults to true), because
sometimes we do want to check forbidden props on DOM nodes
i.e. for "data-*" so we can avoid tying implementation
to thirdparty libraries that work on the DOM.
@burabure burabure force-pushed the forbid-component-props-forbidPatterns branch from 098a123 to 3deeb99 Compare November 1, 2016 17:41
@burabure
Copy link
Contributor Author

burabure commented Nov 2, 2016

all changes done.


### `ignoreComponents`

Whether to skip checking forbidden props on Components (div, input, span, etc...). Defaults to false.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these examples are DOM nodes, not Components

var tag = node.parent.name.name;
if (tag && tag[0] !== tag[0].toUpperCase()) {
// This is a DOM node, not a Component, so exit.
var isComponent = tag && tag[0] === tag[0].toUpperCase();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think your code here is making the false assumption that there's only two kinds of nodes, DOM and Component. nodes can also be strings, numbers, arrays… are we sure this is the right way to check "is dom node" and "is component"? I feel like we have functions for this in the codebase already.


Whether to check forbidden props on DOM nodes (div, input, span, etc...). Defaults to false.

### `ignoreComponents`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@burabure
Copy link
Contributor Author

I dont have time to refactor according to #850. if anyone want to do it please do =)

@ljharb ljharb force-pushed the master branch 2 times, most recently from 380e32c to 51d342b Compare July 4, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants