Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
tslint-react-a11y
✓ In tslint.json: { "extends": ["tslint-react-a11y"] }
✗ Trying to import package via require/import statement
This is a TSLint config package, not a programmatic library. Use config extension not code imports.
react-a11y-accessible-headings
✓ In tslint.json rules section: { "react-a11y-accessible-headings": true }
✗ Using require('tslint-react-a11y').rules or similar
Rules are enabled via tslint.json rules object, not by importing the package.
RulesDirectory
✓ In tslint.json: { "rulesDirectory": ["node_modules/tslint-react-a11y/lib"] }
✗ Forgetting to specify rulesDirectory when not using extends
When using 'extends', rulesDirectory may be automatically set. Check tslint docs.
Complete tslint.json configuration enabling all accessibility rules with example option object.
// tslint.json
{
"extends": ["tslint:latest", "tslint-react", "tslint-react-a11y"],
"rules": {
"react-a11y-anchors": [true, { "ignore-case": false, "ignore-whitespace": "trim" }],
"react-a11y-aria-unsupported-elements": true,
"react-a11y-event-has-role": true,
"react-a11y-image-button-has-alt": true,
"react-a11y-img-has-alt": true,
"react-a11y-lang": true,
"react-a11y-meta": true,
"react-a11y-props": true,
"react-a11y-proptypes": true,
"react-a11y-role": true,
"react-a11y-role-supports-aria-props": true,
"react-a11y-tabindex-no-positive": true,
"react-a11y-titles": true,
// v1.1.0 new rules
"react-a11y-accessible-headings": true,
"react-a11y-iframes": true,
"react-a11y-input-elements": true,
"react-a11y-mouse-event-has-key-event": true,
"react-a11y-no-onchange": true,
"react-a11y-required": true
}
}
Errors
Common errors & fixes
Cannot find module 'tslint'
Missing tslint peer dependency
fixnpm install --save-dev tslint
Unknown rule: react-a11y-accessible-headings
Using v1.0.0 which does not include this rule
fixUpdate to v1.1.0: npm install tslint-react-a11y@1.1.0
TypeError: Cannot read property 'apply' of undefined
Incorrect rulesDirectory path in tslint.json
fixAdd "rulesDirectory": ["node_modules/tslint-react-a11y/lib"]
Audit
Dependencies
tslint-microsoft-contribrequiredBundles the a11y rules extracted from this dependency
tslintrequiredPeer dependency required by the tslint plugin system
typescriptrequiredRequired for TSLint runtime and type checking