@sa11y/preset-rules
Advanced tools
| import axe from 'axe-core'; | ||
| declare const _default: { | ||
| rules: axe.Rule[]; | ||
| }; | ||
| export default _default; | ||
| //# sourceMappingURL=changes.d.ts.map |
| {"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../src/custom-rules/changes.ts"],"names":[],"mappings":"AAMA,OAAO,GAAG,MAAM,UAAU,CAAC;;WAIY,IAAI,IAAI,EAAE;;AAAjD,wBAAoD"} |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const changesData = {}; | ||
| exports.default = changesData; | ||
| //# sourceMappingURL=changes.js.map |
| import axe from 'axe-core'; | ||
| declare const _default: axe.Check[]; | ||
| export default _default; | ||
| //# sourceMappingURL=checks.d.ts.map |
| {"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/custom-rules/checks.ts"],"names":[],"mappings":"AAMA,OAAO,GAAG,MAAM,UAAU,CAAC;;AAgB3B,wBAAwC"} |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const checkData = [ | ||
| { | ||
| id: 'sa11y-Keyboard-check', | ||
| options: ['sa11y-Keyboard-check'], | ||
| evaluate: "function(node, options) { return !!node.hasAttribute('tabindex'); }", | ||
| metadata: { | ||
| impact: 'critical', | ||
| messages: { | ||
| pass: 'Button elements are Keyboard operable', | ||
| fail: "Button elements are not Keyboard operable,To fix add tabindex='0' attribute and appropriate keyboard event handler.", | ||
| }, | ||
| }, | ||
| }, | ||
| ]; | ||
| exports.default = checkData; | ||
| //# sourceMappingURL=checks.js.map |
| import axe from 'axe-core'; | ||
| declare const _default: axe.Rule[]; | ||
| export default _default; | ||
| //# sourceMappingURL=rules.d.ts.map |
| {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/custom-rules/rules.ts"],"names":[],"mappings":"AAMA,OAAO,GAAG,MAAM,UAAU,CAAC;;AAkB3B,wBAAuC"} |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const rulesData = [ | ||
| { | ||
| id: 'sa11y-Keyboard', | ||
| metadata: { | ||
| description: 'Element is not keyboard operable', | ||
| help: "The following button element <strong>'+ ele.innerText+ '</strong> missing keyboard operability. To fix add tabindex='0' attribute and appropriate keyboard event handler.", | ||
| helpUrl: '', | ||
| }, | ||
| selector: "[role='button']:not(a[href],button,input,select,area[href],textarea,[contentEditable=true],[disabled],details)", | ||
| any: [], | ||
| all: ['sa11y-Keyboard-check'], | ||
| none: [], | ||
| tags: ['wcag22aa', 'wcag211'], | ||
| }, | ||
| ]; | ||
| exports.default = rulesData; | ||
| //# sourceMappingURL=rules.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"customRules.d.ts","sourceRoot":"","sources":["../src/customRules.ts"],"names":[],"mappings":"AAcA,wBAAgB,mBAAmB,IAAI,IAAI,CA0B1C"} | ||
| {"version":3,"file":"customRules.d.ts","sourceRoot":"","sources":["../src/customRules.ts"],"names":[],"mappings":"AAWA,wBAAgB,mBAAmB,IAAI,IAAI,CAkB1C"} |
+11
-45
| "use strict"; | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
| Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
| }) : function(o, v) { | ||
| o["default"] = v; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -36,29 +13,18 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
| */ | ||
| const fs = __importStar(require("fs")); | ||
| const path_1 = __importDefault(require("path")); | ||
| const axe_core_1 = __importDefault(require("axe-core")); | ||
| const common_1 = require("@sa11y/common"); | ||
| // Directory containing custom rules and checks | ||
| const customRulesPathDir = 'custom-rules'; | ||
| const checks_1 = __importDefault(require("./custom-rules/checks")); | ||
| const rules_1 = __importDefault(require("./custom-rules/rules")); | ||
| const changes_1 = __importDefault(require("./custom-rules/changes")); | ||
| function registerCustomRules() { | ||
| const directoryPath = path_1.default.join(__dirname, customRulesPathDir); | ||
| const newChecks = []; | ||
| const newRules = []; | ||
| try { | ||
| // Path to the JSON file with changes to existing rules | ||
| const changesInExistingRulesPath = path_1.default.join(directoryPath, 'changes.json'); | ||
| // Read and parse existing rule changes | ||
| const existingRuleData = fs.readFileSync(changesInExistingRulesPath, 'utf-8'); | ||
| const { rules } = JSON.parse(existingRuleData); | ||
| if (rules && Array.isArray(rules)) { | ||
| newRules.push(...rules); | ||
| } | ||
| // Process checks and rules JSON files | ||
| (0, common_1.processFiles)(path_1.default.join(directoryPath, 'checks'), newChecks, '.json', JSON.parse); | ||
| (0, common_1.processFiles)(path_1.default.join(directoryPath, 'rules'), newRules, '.json', JSON.parse); | ||
| // Read and parse existing rule changes | ||
| const { rules } = changes_1.default; | ||
| const newRulesData = rules_1.default; | ||
| const newChecksData = checks_1.default; | ||
| if (rules && Array.isArray(rules)) { | ||
| newRules.push(...rules); | ||
| } | ||
| catch (e) { | ||
| const err = e; | ||
| console.error('Error in reading Custom Rules files: ', err.message); | ||
| } | ||
| newRules.push(...newRulesData); | ||
| newChecks.push(...newChecksData); | ||
| // Configure axe with the new checks and rules | ||
@@ -65,0 +31,0 @@ const spec = { rules: newRules, checks: newChecks }; |
+3
-6
| { | ||
| "name": "@sa11y/preset-rules", | ||
| "version": "6.9.0", | ||
| "version": "6.9.1", | ||
| "description": "Accessibility preset rule configs for axe", | ||
@@ -24,7 +24,4 @@ "license": "BSD-3-Clause", | ||
| "dependencies": { | ||
| "@sa11y/common": "6.9.0" | ||
| "@sa11y/common": "6.9.1" | ||
| }, | ||
| "scripts": { | ||
| "copy-json": "cpx 'src/**/*.json' dist" | ||
| }, | ||
| "devDependencies": { | ||
@@ -41,3 +38,3 @@ "@jest/globals": "28.1.3", | ||
| }, | ||
| "gitHead": "90bd6111dfe1bec4ff98d5e1527a245c3c0a5498" | ||
| "gitHead": "a953b9b6e8a49bb8d1af366e71cd82d573ad7b03" | ||
| } |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
74174
1.04%39
30%596
2.76%3
-25%+ Added
- Removed
Updated