Skip to content
This repository was archived by the owner on May 16, 2020. It is now read-only.

Commit db0fc59

Browse files
feat: add in rules for jsx-a11y and promise ESLint plugins
1 parent 0376b75 commit db0fc59

File tree

3 files changed

+92
-1
lines changed

3 files changed

+92
-1
lines changed

packages/eslint-config-atlauncher/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const rules = [
1111
'./rules/plugin-filenames',
1212
'./rules/plugin-import',
1313
'./rules/plugin-jsx-a11y',
14+
'./rules/plugin-promise',
1415
'./rules/plugin-react'
1516
].map(require.resolve);
1617

@@ -26,7 +27,6 @@ module.exports = {
2627
extends: [
2728
'eslint:recommended',
2829
'plugin:jsx-a11y/recommended',
29-
'plugin:react/recommended',
3030
'plugin:promise/recommended',
3131
...rules
3232
],

packages/eslint-config-atlauncher/rules/plugin-jsx-a11y.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,73 @@
22

33
module.exports = {
44
rules: {
5+
// require all emoji to be wrapped in `<span>` tags with an `aria-label` property
6+
'jsx-a11y/accessible-emoji': 'error',
7+
8+
// requires all anchor tags to have content that isn't hidden
9+
'jsx-a11y/anchor-has-content': 'error',
10+
11+
// disallow using invalid aria attributes
12+
'jsx-a11y/aria-props': 'error',
13+
14+
// require all aria properties are using the correct value
15+
'jsx-a11y/aria-proptypes': 'error',
16+
17+
// require valid aria role properties
18+
'jsx-a11y/aria-role': 'error',
19+
20+
// require all non DOM tags don't have aria attributes
21+
'jsx-a11y/aria-unsupported-elements': 'error',
22+
23+
// ensure all headings have content that isn't hidden
24+
'jsx-a11y/heading-has-content': 'error',
25+
26+
// don't allow anchor tags to have a href that is just `#`
27+
'jsx-a11y/href-no-hash': 'error',
28+
29+
// ensure html tag has a `lang` property
30+
'jsx-a11y/html-has-lang': 'error',
31+
32+
// require all iframe tags to have a `title` property
33+
'jsx-a11y/iframe-has-title': 'error',
34+
35+
// require all image tags to have an `alt` property
36+
'jsx-a11y/img-has-alt': 'error',
37+
38+
// don't allow the workds `image`, `photo` or `picture` in image `alt` property
39+
'jsx-a11y/img-redundant-alt': 'error',
40+
41+
// require all `label` elements have a `htmlFor` property
42+
'jsx-a11y/label-has-for': 'error',
43+
44+
// ensure the `lang` property on the `html` element is valid
45+
'jsx-a11y/lang': 'error',
46+
47+
// don't allow `accessKey` properties on elements
48+
'jsx-a11y/no-access-key': 'error',
49+
50+
// disallows using `marquee` and `blink` elements
51+
'jsx-a11y/no-distracting-elements': 'error',
52+
53+
// require the use of `onBlur` instead of `onChange`
54+
'jsx-a11y/no-onchange': 'error',
55+
56+
// dont allow setting roles on elements that already have that role given by browsers
57+
'jsx-a11y/no-redundant-roles': 'error',
58+
59+
// ensure only interactive DOM elements can have mount/keyboard handlers
60+
'jsx-a11y/no-static-element-interactions': 'error',
61+
62+
// ensure roles have the required aria properties
63+
'jsx-a11y/role-has-required-aria-props': 'error',
64+
65+
// ensure all roles only use supported aria properties
66+
'jsx-a11y/role-supports-aria-props': 'error',
67+
68+
// ensure the `scope` property is only used on `th` elements
69+
'jsx-a11y/scope': 'error',
70+
71+
// don't allow positive values for `tabIndex`
72+
'jsx-a11y/tabindex-no-positive': 'error'
573
}
674
};
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* eslint-disable import/no-commonjs */
2+
3+
module.exports = {
4+
rules: {
5+
// when using `.then` on a promise, a `.catch` must always be included
6+
'promise/catch-or-return': 'error',
7+
8+
// require all `.then` blocks to return a value rathen than using `Promise.resolve` or `Promise.reject`
9+
'promise/no-return-wrap': 'error',
10+
11+
// requires all promises to use paramater names of `resolve` and `reject`
12+
'promise/param-names': 'error',
13+
14+
// require all `.then` blocks to return a value or throw an error
15+
'promise/always-return': 'error',
16+
17+
// avoid nesting promises
18+
'promise/no-nesting': 'error',
19+
20+
// prefer using await to `.then`
21+
'promise/prefer-await-to-then': 'error'
22+
}
23+
};

0 commit comments

Comments
 (0)