in src/utils.js [447:489]
export function createCompatibilityRule(
application,
message,
context,
bcd,
hasBrowserApi
) {
const { addonMetadata } = context.settings;
const minVersion =
addonMetadata &&
firefoxStrictMinVersion({
applications: {
gecko: {
strict_min_version: context.settings.addonMetadata.firefoxMinVersion,
},
},
});
if (minVersion) {
return {
MemberExpression(node) {
if (
!node.computed &&
node.object.object &&
isBrowserNamespace(node.object.object.name)
) {
const namespace = node.object.property.name;
const property = node.property.name;
const api = `${namespace}.${property}`;
if (
hasBrowserApi(namespace, property, addonMetadata) &&
!isCompatible(bcd, api, minVersion, application)
) {
context.report(node, message.messageFormat, {
api,
minVersion: addonMetadata.firefoxMinVersion,
});
}
}
},
};
}
return {};
}