Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default display-name's acceptTranspilerName to true #439

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/rules/display-name.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var Hello = React.createClass({

### `acceptTranspilerName`

When `true` the rule will accept the name set by the transpiler and does not require a `displayName` property in this case.
When `true` (default) the rule will accept the name set by the transpiler and does not require a `displayName` property in this case.

The following patterns are considered okay and do not cause warnings:

Expand Down
4 changes: 3 additions & 1 deletion lib/rules/display-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ module.exports = Components.detect(function(context, components, utils) {

var sourceCode = context.getSourceCode();
var config = context.options[0] || {};
var acceptTranspilerName = config.acceptTranspilerName || false;
var acceptTranspilerName = config.hasOwnProperty('acceptTranspilerName') ?
Copy link
Member

Choose a reason for hiding this comment

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

instead of making "absence" and "falsy" be different, would it be better as a breaking change to rename the option to something like "ignoreTranspilerName"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I definitely like that better--I was just doing what @yannickcr had written in the plan. I'm going to be afk for the next few days starting soon, so I'll push another version and he can choose his favorite.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

New version is at #440

Copy link
Member

Choose a reason for hiding this comment

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

👍

config.acceptTranspilerName :
true;

var MISSING_MESSAGE = 'Component definition is missing display name';

Expand Down
Loading