Skip to content
This repository has been archived by the owner on Feb 28, 2025. It is now read-only.

Simplify JSX a11y rules to use the recommended ones #13

Merged
merged 7 commits into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
/.idea
node_modules/
package-lock.json

############
## OSes
############

[Tt]humbs.db
[Dd]esktop.ini
*.DS_store
.DS_store?

############
## Misc
############

*.tmp
*.bak
*.log
*.[Cc]ache
*.cpr
*.orig
*.php.in
.idea/
temp/
._*
.Trashes
.svn
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

### 5.0 - 2018-09-21

#### Breaking changes

* Use the JSX a11y recommended rules, only exception is `label-has-for`.

#### Changed

* Sets `react/button-has-type` to warning as this rule [is pretty useless in its current state](https://github.com/yannickcr/eslint-plugin-react/issues/1555).
* Adds an exception for translators comments in `capitalized-comments`.

### 4.0 - 2018-09-07

#### Breaking changes
Expand Down
33 changes: 6 additions & 27 deletions default.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
extends:
- "eslint:recommended"
- "plugin:react/recommended"
- "plugin:jsx-a11y/recommended"

parserOptions:
ecmaVersion: 2017
Expand All @@ -22,7 +23,7 @@ plugins:
# http://eslint.org/docs/rules/
rules:
# Possible Errors
comma-dangle: [2, always-multiline]
comma-dangle: [2, "always-multiline"]
no-cond-assign: 2
no-console: [ 2, { allow: ["warn", "error", "trace"] } ]
no-constant-condition: 2
Expand Down Expand Up @@ -146,7 +147,7 @@ rules:
block-spacing: [2, always]
brace-style: [2, 1tbs]
camelcase: 2
capitalized-comments: 2
capitalized-comments: [2, always, { "ignorePattern": "translators" }]
comma-spacing: 2
comma-style: 2
computed-property-spacing: [2, always]
Expand Down Expand Up @@ -226,31 +227,9 @@ rules:
spaced-comment: [2, "always"]
wrap-regex: 0


# Accessibility rules. https://github.com/evcohen/eslint-plugin-jsx-a11y
jsx-a11y/anchor-has-content: 1 # Passes if it's empty but has an aria-label attribute.
jsx-a11y/aria-props: 2
jsx-a11y/aria-proptypes: 2
jsx-a11y/aria-role: 2
jsx-a11y/aria-unsupported-elements: 2
jsx-a11y/click-events-have-key-events: 2
jsx-a11y/heading-has-content: 2
jsx-a11y/href-no-hash: 1 # Checks only for `#` and doesn't check other invalid values. Passes if it has a role="button". However, consider to use a real button.
jsx-a11y/html-has-lang: 2
jsx-a11y/img-has-alt: 2
jsx-a11y/img-redundant-alt: 2
jsx-a11y/label-has-for: 1 # Checks only for the presence of the for attribute. Doesn't check if the for value is correct. Doesn't check for missing labels. A bit pointless.
jsx-a11y/mouse-events-have-key-events: 1 # Should be evaluated on a case by case basis.
jsx-a11y/no-access-key: 2
jsx-a11y/no-marquee: 2
jsx-a11y/no-onchange: 1 # Should be evaluated on a case by case basis. Try to avoid onchange anyways.
jsx-a11y/no-static-element-interactions: 1
jsx-a11y/onclick-has-focus: 2
jsx-a11y/onclick-has-role: 2
jsx-a11y/role-has-required-aria-props: 2
jsx-a11y/role-supports-aria-props: 2
jsx-a11y/scope: 2
jsx-a11y/tabindex-no-positive: 2
# Deprecated in v6.1.0 in favor of label-has-associated-control but we still want to require only for/id and not nesting.
jsx-a11y/label-has-for: [2, { "required": "id" } ]

# React plugins settings (https://github.com/yannickcr/eslint-plugin-react/tree/master/docs/rules)
react/jsx-tag-spacing: [2, {"beforeClosing": "never"}]
Expand Down Expand Up @@ -279,5 +258,5 @@ rules:
react/no-access-state-in-setstate: 2
react/forbid-foreign-prop-types: 2
react/default-props-match-prop-types: 2
react/button-has-type: 2
react/button-has-type: 0 # See https://github.com/yannickcr/eslint-plugin-react/issues/1555
react/boolean-prop-naming: 2
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-yoast",
"version": "4.0.0",
"version": "5.0.0",
"description": "ESLint configuration for Yoast projects",
"keywords": [
"eslint",
Expand All @@ -24,7 +24,7 @@
"js-yaml": "^3.6.0"
},
"peerDependencies": {
"eslint-plugin-react": ">=6.0.0",
"eslint-plugin-react": ">=7.11.1",
"eslint-plugin-jsx-a11y": ">=6.1.1"
}
}