in src/options.js [116:163]
export default function (...args) {
// signature is a11y(React, opts) or a11y(React, ReactDOM, opts)
// so destructure args based on number of args passed
let props = [];
if (args.length === 2) {
if (args[1].findDOMNode === undefined) {
props = [args[0], null, args[1] || {}];
} else {
props = [args[0], args[1], {}];
}
} else {
props = args;
}
const [
React,
ReactDOM,
opts
] = props;
if (!React || !React.createElement) {
throw new Error(`${LOG_PREFIX} missing argument 'React'`);
}
// make sure ReactDOM is passed in in browser code
if (browser && !(ReactDOM && ReactDOM.findDOMNode)) {
throw new Error(`${LOG_PREFIX} missing argument 'ReactDOM'`);
}
deprecate(opts, 'includeSrcNode', msg);
deprecate(opts, 'throw', msg);
deprecate(opts, 'warningPrefix', msg);
const {
reporter = mkReporter(opts), // make a reporter based on options
filterFn = always,
plugins = [],
rules = {}
} = opts;
return {
React,
ReactDOM,
filterFn,
reporter,
plugins,
rules
};
}