lib/rules/no-restricted-properties.js
function checkPropertyAccess(node, objectName, propertyName) {
            if (propertyName === null) {
                return;
            }
            const matchedObject = restrictedProperties.get(objectName);
            const matchedObjectProperty = matchedObject ? matchedObject.get(propertyName) : globallyRestrictedObjects.get(objectName);
            const globalMatchedProperty = globallyRestrictedProperties.get(propertyName);

            if (matchedObjectProperty) {
                const message = matchedObjectProperty.message ? ` ${matchedObjectProperty.message}` : "";

                context.report({
                    node,
                    // eslint-disable-next-line eslint-plugin/report-message-format
                    message: "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}",
                    data: {
                        objectName,
                        propertyName,
                        message
                    }
                });
            } else if (globalMatchedProperty) {
                const message = globalMatchedProperty.message ? ` ${globalMatchedProperty.message}` : "";

                context.report({
                    node,
                    // eslint-disable-next-line eslint-plugin/report-message-format
                    message: "'{{propertyName}}' is restricted from being used.{{message}}",
                    data: {
                        propertyName,
                        message
                    }
                });
            }
        }
function checkPropertyAccess(node, objectName, propertyName) {
            if (propertyName === null) {
                return;
            }
            const matchedObject = restrictedProperties.get(objectName);
            const matchedObjectProperty = matchedObject ? matchedObject.get(propertyName) : globallyRestrictedObjects.get(objectName);
            const globalMatchedProperty = globallyRestrictedProperties.get(propertyName);

            if (matchedObjectProperty) {
                const message = matchedObjectProperty.message ? ` ${matchedObjectProperty.message}` : "";

                context.report({
                    node,
                    // eslint-disable-next-line eslint-plugin/report-message-format
                    message: "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}",
                    data: {
                        objectName,
                        propertyName,
                        message
                    }
                });
            } else if (globalMatchedProperty) {
                const message = globalMatchedProperty.message ? ` ${globalMatchedProperty.message}` : "";

                context.report({
                    node,
                    // eslint-disable-next-line eslint-plugin/report-message-format
                    message: "'{{propertyName}}' is restricted from being used.{{message}}",
                    data: {
                        propertyName,
                        message
                    }
                });
            }
        }
function checkPropertyAccess ( node , objectName , propertyName ) { if ( propertyName === null ) { return ; } const matchedObject = restrictedProperties . get ( objectName ) ; const matchedObjectProperty = matchedObject ? matchedObject . get ( propertyName ) : globallyRestrictedObjects . get ( objectName ) ; const globalMatchedProperty = globallyRestrictedProperties . get ( propertyName ) ; if ( matchedObjectProperty ) { const message = matchedObjectProperty . message ? ` ${ matchedObjectProperty . message } ` : "" ; context . report ( { node , // eslint-disable-next-line eslint-plugin/report-message-format message : "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}" , data : { objectName , propertyName , message } } ) ; } else if ( globalMatchedProperty ) { const message = globalMatchedProperty . message ? ` ${ globalMatchedProperty . message } ` : "" ; context . report ( { node , // eslint-disable-next-line eslint-plugin/report-message-format message : "'{{propertyName}}' is restricted from being used.{{message}}" , data : { propertyName , message } } ) ; } }
Checks to see whether a property access is restricted, and reports it if so.
@param {ASTNode} node The node to report
@param {string} objectName The name of the object
@param {string} propertyName The name of the property
@returns {undefined}
Checks to see whether a property access is restricted and reports it if so .