react-kiwi-dropdown
Version:
A minimal, easy-to-use and highly adjustable dropdown component made with ReactJS.
41 lines (34 loc) • 1.07 kB
JavaScript
/**
* @fileoverview Prevent React to be marked as unused
* @author Glen Mailer
*/
;
const pragmaUtil = require('../util/pragma');
const docsUrl = require('../util/docsUrl');
// ------------------------------------------------------------------------------
// Rule Definition
// ------------------------------------------------------------------------------
module.exports = {
meta: {
docs: {
description: 'Prevent React to be marked as unused',
category: 'Best Practices',
recommended: true,
url: docsUrl('jsx-uses-react')
},
schema: []
},
create: function(context) {
const pragma = pragmaUtil.getFromContext(context);
function handleOpeningElement() {
context.markVariableAsUsed(pragma);
}
// --------------------------------------------------------------------------
// Public
// --------------------------------------------------------------------------
return {
JSXOpeningElement: handleOpeningElement,
JSXOpeningFragment: handleOpeningElement
};
}
};