prettier-config-a11y v1.1.2
prettier-config-a11y
Prettier config improving accessibility for visual, cognitive, and motor disabilities
Installation
npm install --save-dev prettier prettier-config-a11y
yarn add --dev prettier prettier-config-a11y
pnpm add --save-dev prettier prettier-config-a11y
Usage
package.json
"prettier": "prettier-config-a11y"
Other Prettier config
"prettier-config-a11y"
Rationale
Here's what I've changed from Prettier's config and why. Most of the defaults are already pretty good, so check out the Prettier docs for more information.
"useTabs": true
Indentations are easier for assistive technology to read when using tabs instead of spaces because they take up less characters. Visual representations of tab indentations can also be increased by users with visual and cognitive disabilities without affecting other users.
"proseWrap": "always"
By default, Prettier does not wrap prose, resulting in inconsistently long lines that are harder to read without soft wrapping.
Defaults
Prettier 3 already uses these defaults, but we set them explicitly to encourage accessibility, even with older versions of Prettier.
"semi": true
Disabled users are more likely to prefer semicolons (source: Twitter poll), likely because they make it easier to understand when lines of code end, even when Prettier wraps them.
"singleQuote": false
and "jsxSingleQuote": false
Double quotes are easier for some assistive technology to read because single quotes may be spoken as "apostrophe", which is a syllable longer than "double quote", while "single quote" sounds about as long. Double quotes are also larger, making them easier to see. Meanwhile, HTML and JSX code is typically formatted with double quotes, so consistently using double quotes in other languages makes code behave more consistently and potentially reduces cognitive load.
"trailingComma": "all"
Reduces the size of diffs, making them easier to read, especially with visual and cognitive disabilities.
"arrowParens": "always"
Keeps arguments in arrow functions consistent and easy to adjust, resulting in less work for those with cognitive and motor disabilities.
"endOfLine": "lf"
This reduces unnecessary end of line changes when switching operating systems, which can can be especially confusing for those with disabilities.
4 months ago
4 months ago
4 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago