"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = _default; exports.ruleName = exports.messages = void 0; var _stylelint = require("stylelint"); var _isStandardSyntaxRule = _interopRequireDefault(require("stylelint/lib/utils/isStandardSyntaxRule")); var _obsoleteAttributes = require("./obsoleteAttributes"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } var ruleName = 'a11y/no-obsolete-attribute'; exports.ruleName = ruleName; var messages = _stylelint.utils.ruleMessages(ruleName, { expected: function expected(selector) { return "Unexpected using obsolete attribute \"".concat(selector, "\""); } }); exports.messages = messages; function check(selector, node) { if (node.type !== 'rule') { return true; } return !node.selectors.some(function (sel) { return _obsoleteAttributes.obsoleteAttributes.has(sel); }); } function _default(actual) { return function (root, result) { var validOptions = _stylelint.utils.validateOptions(result, ruleName, { actual: actual }); if (!validOptions || !actual) { return; } root.walk(function (node) { var selector = null; if (node.type === 'rule') { if (!(0, _isStandardSyntaxRule["default"])(node)) { return; } selector = node.selector; } else if (node.type === 'atrule' && node.name.toLowerCase() === 'page' && node.params) { selector = node.params; } if (!selector) { return; } var isAccepted = check(selector, node); if (!isAccepted) { _stylelint.utils.report({ index: node.lastEach, message: messages.expected(selector), node: node, ruleName: ruleName, result: result }); } }); }; }