Skip to content

Commit f8d1aca

Browse files
committed
allow es6 class rule to be configured to discourage usage as well
1 parent 1e17259 commit f8d1aca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/rules/prefer-es6-class.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ var Components = require('../util/Components');
1111
// ------------------------------------------------------------------------------
1212

1313
module.exports = Components.detect(function(context, components, utils) {
14+
var configuration = context.options[0] || 'always';
1415

1516
return {
1617
ObjectExpression: function(node) {
17-
if (utils.isES5Component(node)) {
18+
if (utils.isES5Component(node) && configuration === 'always') {
1819
context.report(node, 'Component should use es6 class instead of createClass');
20+
} else if (utils.isES6Component(node) && configuration === 'never') {
21+
context.report(node, 'Component should use createClass instead of es6 class');
1922
}
2023
}
2124
};

0 commit comments

Comments
 (0)