UNPKG

@locker/eslint-plugin-locker

Version:
30 lines (29 loc) 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const eslint_rule_maker_1 = require("@locker/eslint-rule-maker"); const util_1 = require("../util"); exports.default = (0, eslint_rule_maker_1.createRule)({ meta: { docs: { description: `distorted CacheStorage properties`, category: 'Lightning Web Security', recommended: true, url: (0, util_1.docURL)('distorted-cookie-store-properties'), }, }, rule: { message({ pattern }) { const cachesDot = 'caches.'; const lastIndex = pattern.lastIndexOf(cachesDot); const property = pattern.slice(lastIndex + cachesDot.length); return `CacheStorage.prototype.${property} is distorted by Lightning Web Security.`; }, search: [ 'window.caches.delete', 'window.caches.has', 'window.caches.keys', 'window.caches.match', 'window.caches.open', ], }, });