@sa11y/format
Advanced tools
Comparing version 6.9.5-alpha.4 to 6.9.5
import { AxeResults } from '@sa11y/common'; | ||
import { NodeResult, Result } from 'axe-core'; | ||
import { NodeResult, Result, CheckResult } from 'axe-core'; | ||
export declare class A11yResults { | ||
@@ -39,2 +39,5 @@ private static consolidated; | ||
readonly none: string; | ||
readonly relatedNodeAny: string; | ||
readonly relatedNodeAll: string; | ||
readonly relatedNodeNone: string; | ||
private readonly wcagData; | ||
@@ -46,2 +49,3 @@ constructor(violation: Result, node: NodeResult); | ||
static sort(results: A11yResult[]): A11yResult[]; | ||
formatRelatedNodes(node: CheckResult[]): string; | ||
} | ||
@@ -48,0 +52,0 @@ /** |
@@ -6,3 +6,3 @@ "use strict"; | ||
const defaultImpact = 'minor'; // if impact is undefined | ||
const formatSpacing = '\t'.repeat(12); | ||
const formatSpacing = '\t'.repeat(6); | ||
// Helper object to sort violations by impact order | ||
@@ -70,3 +70,3 @@ const impactOrder = { | ||
this.id = violation.id; | ||
this.description = violation.help; | ||
this.description = violation.description; | ||
this.wcagData = new preset_rules_1.WcagMetadata(violation); | ||
@@ -85,2 +85,5 @@ this.wcag = this.wcagData.toString(); | ||
this.none = node.none?.map((item) => `${formatSpacing}• ${item.message}`).join('\n'); | ||
this.relatedNodeAny = this.formatRelatedNodes(node.any); | ||
this.relatedNodeAll = this.formatRelatedNodes(node.all); | ||
this.relatedNodeNone = this.formatRelatedNodes(node.none); | ||
} | ||
@@ -99,2 +102,10 @@ /** | ||
} | ||
formatRelatedNodes(node) { | ||
return node | ||
?.map((item) => item.relatedNodes && item.relatedNodes.length > 0 | ||
? item.relatedNodes.map((relatedNode) => `${formatSpacing}• ${relatedNode.html}`).join('\n') | ||
: null) | ||
.filter(Boolean) | ||
.join('\n'); | ||
} | ||
} | ||
@@ -101,0 +112,0 @@ exports.A11yResult = A11yResult; |
{ | ||
"name": "@sa11y/format", | ||
"version": "6.9.5-alpha.4", | ||
"version": "6.9.5", | ||
"description": "Accessibility results re-formatter", | ||
@@ -27,4 +27,4 @@ "license": "BSD-3-Clause", | ||
"dependencies": { | ||
"@sa11y/common": "6.9.5-alpha.4", | ||
"@sa11y/preset-rules": "6.9.5-alpha.4", | ||
"@sa11y/common": "6.9.5", | ||
"@sa11y/preset-rules": "6.9.5", | ||
"axe-core": "4.9.0" | ||
@@ -34,3 +34,3 @@ }, | ||
"@jest/globals": "28.1.3", | ||
"@sa11y/test-utils": "6.9.5-alpha.4" | ||
"@sa11y/test-utils": "6.9.5" | ||
}, | ||
@@ -43,3 +43,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "f76314d90c55041be24e945d6cd424f59a38c368" | ||
"gitHead": "20778083b656180c2b077a4a7148cf813c05d040" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
22166
400
0
+ Added@sa11y/common@6.9.5(transitive)
+ Added@sa11y/preset-rules@6.9.5(transitive)
- Removed@sa11y/common@6.9.5-alpha.4(transitive)
- Removed@sa11y/preset-rules@6.9.5-alpha.4(transitive)
Updated@sa11y/common@6.9.5
Updated@sa11y/preset-rules@6.9.5