<commit_before>/**
 * @fileoverview Prefer es6 class instead of createClass for React Component
 * @author <NAME>
 */
'use strict';

var Components = require('../util/Components');

// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------

module.exports = Components.detect(function(context, components, utils) {

  return {
    ObjectExpression: function(node) {
      if (utils.isES5Component(node)) {
        context.report(node, 'Component should use es6 class instead of createClass');
      }
    }
  };
});

module.exports.schema = [];<commit_msg>allow es6 class rule to be configured to discourage usage as well<commit_after>/**
 * @fileoverview Prefer es6 class instead of createClass for React Component
 * @author <NAME>
 */
'use strict';

var Components = require('../util/Components');

// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------

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

  return {
    ObjectExpression: function(node) {
      if (utils.isES5Component(node) && configuration === 'always') {
        context.report(node, 'Component should use es6 class instead of createClass');
      } else if (utils.isES6Component(node) && configuration === 'never') {
        context.report(node, 'Component should use createClass instead of es6 class');
      }
    }
  };
});

module.exports.schema = [];
{'fraction_non_alphanumeric': 0.2980132450331126, 'fraction_numerical': 0.006020469596628537, 'mean_word_length': 1.756218905472637, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6248538', 'n_tokens_mistral': 385, 'n_tokens_neox': 381, 'n_words': 109}