Skip to content

Commit

Permalink
docs: add documentation for new introduced options
Browse files Browse the repository at this point in the history
  • Loading branch information
akulsr0 committed May 6, 2024
1 parent caf714e commit a3b7044
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/rules/no-danger.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ var React = require('react');
var Hello = <div>Hello World</div>;
```

## Rule Options

```js
...
"react/no-danger": [<enabled>, {
"checkCustomComponents": boolean,
"customComponentNames": Array<string>,
}]
...
```

### checkCustomComponents

Defaults to `false`, when `enabled` allows the rule to check for custom components.

### customComponentNames

If you want to enable this rule for a specific set of custom components, you can pass `checkCustomComponents` as `true` and `customComponentNames` as the array of name of your custom components.

## When Not To Use It

If you are certain the content passed to dangerouslySetInnerHTML is sanitized HTML you can disable this rule.
1 change: 1 addition & 0 deletions lib/rules/no-danger.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const messages = {
dangerousProp: 'Dangerous property \'{{name}}\' found',
};

/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
docs: {
Expand Down

0 comments on commit a3b7044

Please sign in to comment.