Skip to content

Commit f27d22b

Browse files
committed
revert schema
1 parent 8913fe2 commit f27d22b

20 files changed

+112
-60
lines changed

README.md

Lines changed: 40 additions & 40 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"test:ci": "npm run jest -- --ci --runInBand",
3232
"jest": "jest --coverage __tests__/**/*",
3333
"pregenerate-list-of-rules": "npm run build",
34-
"generate-list-of-rules": "eslint-doc-generator --rule-doc-title-format prefix-name --config-emoji recommended,☑️",
34+
"generate-list-of-rules": "eslint-doc-generator --rule-doc-title-format prefix-name --rule-doc-section-options false --config-emoji recommended,☑️",
3535
"generate-list-of-rules:check": "npm run generate-list-of-rules -- --check"
3636
},
3737
"devDependencies": {
@@ -47,7 +47,7 @@
4747
"babel-preset-airbnb": "^5.0.0",
4848
"eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8",
4949
"eslint-config-airbnb-base": "^15.0.0",
50-
"eslint-doc-generator": "^0.15.0",
50+
"eslint-doc-generator": "^0.16.0",
5151
"eslint-plugin-eslint-plugin": "^4.3.0",
5252
"eslint-plugin-flowtype": "^5.8.0 || ^8.0.3",
5353
"eslint-plugin-import": "^2.26.0",

src/rules/accessible-emoji.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,21 @@
99

1010
import emojiRegex from 'emoji-regex';
1111
import { getProp, getLiteralPropValue } from 'jsx-ast-utils';
12+
import { generateObjSchema } from '../util/schemas';
1213
import getElementType from '../util/getElementType';
1314
import isHiddenFromScreenReader from '../util/isHiddenFromScreenReader';
1415

1516
const errorMessage = 'Emojis should be wrapped in <span>, have role="img", and have an accessible description with aria-label or aria-labelledby.';
1617

18+
const schema = generateObjSchema();
19+
1720
export default {
1821
meta: {
1922
docs: {
2023
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/accessible-emoji.md',
2124
},
2225
deprecated: true,
23-
schema: [],
26+
schema: [schema],
2427
},
2528

2629
create: (context) => {

src/rules/aria-activedescendant-has-tabindex.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { dom } from 'aria-query';
77
import { getProp } from 'jsx-ast-utils';
8+
import { generateObjSchema } from '../util/schemas';
89
import getElementType from '../util/getElementType';
910
import getTabIndex from '../util/getTabIndex';
1011
import isInteractiveElement from '../util/isInteractiveElement';
@@ -15,6 +16,8 @@ import isInteractiveElement from '../util/isInteractiveElement';
1516

1617
const errorMessage = 'An element that manages focus with `aria-activedescendant` must have a tabindex';
1718

19+
const schema = generateObjSchema();
20+
1821
const domElements = [...dom.keys()];
1922

2023
export default {
@@ -23,7 +26,7 @@ export default {
2326
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/aria-activedescendant-has-tabindex.md',
2427
description: 'Enforce elements with aria-activedescendant are tabbable.',
2528
},
26-
schema: [],
29+
schema: [schema],
2730
},
2831

2932
create: (context) => {

src/rules/aria-props.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import { aria } from 'aria-query';
1111
import { propName } from 'jsx-ast-utils';
12+
import { generateObjSchema } from '../util/schemas';
1213
import getSuggestion from '../util/getSuggestion';
1314

1415
const ariaAttributes = [...aria.keys()];
@@ -24,13 +25,15 @@ const errorMessage = (name) => {
2425
return message;
2526
};
2627

28+
const schema = generateObjSchema();
29+
2730
export default {
2831
meta: {
2932
docs: {
3033
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/aria-props.md',
3134
description: 'Enforce all `aria-*` props are valid.',
3235
},
33-
schema: [],
36+
schema: [schema],
3437
},
3538

3639
create: (context) => ({

src/rules/aria-proptypes.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import { aria } from 'aria-query';
1111
import { getLiteralPropValue, getPropValue, propName } from 'jsx-ast-utils';
12+
import { generateObjSchema } from '../util/schemas';
1213

1314
const errorMessage = (name, type, permittedValues) => {
1415
switch (type) {
@@ -59,14 +60,16 @@ const validityCheck = (value, expectedType, permittedValues) => {
5960
}
6061
};
6162

63+
const schema = generateObjSchema();
64+
6265
export default {
6366
validityCheck,
6467
meta: {
6568
docs: {
6669
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/aria-proptypes.md',
6770
description: 'Enforce ARIA state and property values are valid.',
6871
},
69-
schema: [],
72+
schema: [schema],
7073
},
7174

7275
create: (context) => ({

src/rules/aria-unsupported-elements.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,23 @@ import {
1313
dom,
1414
} from 'aria-query';
1515
import { propName } from 'jsx-ast-utils';
16+
import { generateObjSchema } from '../util/schemas';
1617
import getElementType from '../util/getElementType';
1718

1819
const errorMessage = (invalidProp) => (
1920
`This element does not support ARIA roles, states and properties. \
2021
Try removing the prop '${invalidProp}'.`
2122
);
2223

24+
const schema = generateObjSchema();
25+
2326
export default {
2427
meta: {
2528
docs: {
2629
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/aria-unsupported-elements.md',
2730
description: 'Enforce that elements that do not support ARIA roles, states, and properties do not have those attributes.',
2831
},
29-
schema: [],
32+
schema: [schema],
3033
},
3134

3235
create: (context) => {

src/rules/click-events-have-key-events.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
import { dom } from 'aria-query';
1111
import { getProp, hasAnyProp } from 'jsx-ast-utils';
1212
import includes from 'array-includes';
13+
import { generateObjSchema } from '../util/schemas';
1314
import getElementType from '../util/getElementType';
1415
import isHiddenFromScreenReader from '../util/isHiddenFromScreenReader';
1516
import isInteractiveElement from '../util/isInteractiveElement';
1617
import isPresentationRole from '../util/isPresentationRole';
1718

1819
const errorMessage = 'Visible, non-interactive elements with click handlers must have at least one keyboard listener.';
1920

21+
const schema = generateObjSchema();
2022
const domElements = [...dom.keys()];
2123

2224
export default {
@@ -25,7 +27,7 @@ export default {
2527
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/click-events-have-key-events.md',
2628
description: 'Enforce a clickable non-interactive element has at least one keyboard event listener.',
2729
},
28-
schema: [],
30+
schema: [schema],
2931
},
3032

3133
create: (context) => {

src/rules/html-has-lang.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,20 @@
88
// ----------------------------------------------------------------------------
99

1010
import { getProp, getPropValue } from 'jsx-ast-utils';
11+
import { generateObjSchema } from '../util/schemas';
1112
import getElementType from '../util/getElementType';
1213

1314
const errorMessage = '<html> elements must have the lang prop.';
1415

16+
const schema = generateObjSchema();
17+
1518
export default {
1619
meta: {
1720
docs: {
1821
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/html-has-lang.md',
1922
description: 'Enforce `<html>` element has `lang` prop.',
2023
},
21-
schema: [],
24+
schema: [schema],
2225
},
2326

2427
create: (context) => {

src/rules/iframe-has-title.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@
99

1010
import { getProp, getPropValue } from 'jsx-ast-utils';
1111
import getElementType from '../util/getElementType';
12+
import { generateObjSchema } from '../util/schemas';
1213

1314
const errorMessage = '<iframe> elements must have a unique title property.';
1415

16+
const schema = generateObjSchema();
17+
1518
export default {
1619
meta: {
1720
docs: {
1821
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/iframe-has-title.md',
1922
description: 'Enforce iframe elements have a title attribute.',
2023
},
21-
schema: [],
24+
schema: [schema],
2225
},
2326

2427
create: (context) => {

src/rules/lang.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@
99

1010
import { propName, getLiteralPropValue } from 'jsx-ast-utils';
1111
import tags from 'language-tags';
12+
import { generateObjSchema } from '../util/schemas';
1213
import getElementType from '../util/getElementType';
1314

1415
const errorMessage = 'lang attribute must have a valid value.';
1516

17+
const schema = generateObjSchema();
18+
1619
export default {
1720
meta: {
1821
docs: {
1922
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/lang.md',
2023
description: 'Enforce lang attribute has a valid value.',
2124
},
22-
schema: [],
25+
schema: [schema],
2326
},
2427

2528
create: (context) => {

src/rules/mouse-events-have-key-events.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@
1010

1111
import { dom } from 'aria-query';
1212
import { getProp, getPropValue } from 'jsx-ast-utils';
13+
import { generateObjSchema } from '../util/schemas';
1314

1415
const mouseOverErrorMessage = 'onMouseOver must be accompanied by onFocus for accessibility.';
1516
const mouseOutErrorMessage = 'onMouseOut must be accompanied by onBlur for accessibility.';
1617

18+
const schema = generateObjSchema();
19+
1720
export default {
1821
meta: {
1922
docs: {
2023
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/mouse-events-have-key-events.md',
2124
description: 'Enforce that `onMouseOver`/`onMouseOut` are accompanied by `onFocus`/`onBlur` for keyboard-only users.',
2225
},
23-
schema: [],
26+
schema: [schema],
2427
},
2528

2629
create: (context) => ({

src/rules/no-access-key.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@
88
// ----------------------------------------------------------------------------
99

1010
import { getProp, getPropValue } from 'jsx-ast-utils';
11+
import { generateObjSchema } from '../util/schemas';
1112

1213
const errorMessage = 'No access key attribute allowed. Inconsistencies between keyboard shortcuts and keyboard commands used by screenreaders and keyboard-only users create a11y complications.';
1314

15+
const schema = generateObjSchema();
16+
1417
export default {
1518
meta: {
1619
docs: {
1720
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/no-access-key.md',
1821
description: 'Enforce that the `accessKey` prop is not used on any element to avoid complications with keyboard commands used by a screenreader.',
1922
},
20-
schema: [],
23+
schema: [schema],
2124
},
2225

2326
create: (context) => ({

src/rules/no-aria-hidden-on-focusable.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,18 @@
1010
import { getProp, getPropValue } from 'jsx-ast-utils';
1111
import getElementType from '../util/getElementType';
1212
import isFocusable from '../util/isFocusable';
13+
import { generateObjSchema } from '../util/schemas';
1314

1415
const errorMessage = 'aria-hidden="true" must not be set on focusable elements.';
16+
const schema = generateObjSchema();
1517

1618
export default {
1719
meta: {
1820
docs: {
1921
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/no-aria-hidden-on-focusable.md',
2022
description: errorMessage,
2123
},
22-
schema: [],
24+
schema: [schema],
2325
},
2426

2527
create(context) {

src/rules/no-onchange.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// ----------------------------------------------------------------------------
99

1010
import { getProp } from 'jsx-ast-utils';
11+
import { generateObjSchema } from '../util/schemas';
1112
import getElementType from '../util/getElementType';
1213

1314
const errorMessage = 'onBlur must be used instead of onchange, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users.';
@@ -17,14 +18,16 @@ const applicableTypes = [
1718
'option',
1819
];
1920

21+
const schema = generateObjSchema();
22+
2023
export default {
2124
meta: {
2225
docs: {
2326
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/no-onchange.md',
2427
description: 'Enforce usage of `onBlur` over `onChange` on select menus for accessibility.',
2528
},
2629
deprecated: true,
27-
schema: [],
30+
schema: [schema],
2831
},
2932

3033
create: (context) => {

src/rules/prefer-tag-over-role.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import { roleElements } from 'aria-query';
22
import { getProp, getPropValue } from 'jsx-ast-utils';
33

44
import getElementType from '../util/getElementType';
5+
import { generateObjSchema } from '../util/schemas';
56

67
const errorMessage = 'Use {{tag}} instead of the "{{role}}" role to ensure accessibility across all devices.';
78

9+
const schema = generateObjSchema();
10+
811
const formatTag = (tag) => {
912
if (!tag.attributes) {
1013
return `<${tag.name}>`;
@@ -34,7 +37,7 @@ export default {
3437
docs: {
3538
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/prefer-tag-over-role.md',
3639
},
37-
schema: [],
40+
schema: [schema],
3841
},
3942

4043
create: (context) => {

src/rules/role-has-required-aria-props.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,23 @@ import {
1414
getLiteralPropValue,
1515
propName,
1616
} from 'jsx-ast-utils';
17+
import { generateObjSchema } from '../util/schemas';
1718
import getElementType from '../util/getElementType';
1819
import isSemanticRoleElement from '../util/isSemanticRoleElement';
1920

2021
const errorMessage = (role, requiredProps) => (
2122
`Elements with the ARIA role "${role}" must have the following attributes defined: ${String(requiredProps).toLowerCase()}`
2223
);
2324

25+
const schema = generateObjSchema();
26+
2427
export default {
2528
meta: {
2629
docs: {
2730
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/role-has-required-aria-props.md',
2831
description: 'Enforce that elements with ARIA roles must have all required attributes for that role.',
2932
},
30-
schema: [],
33+
schema: [schema],
3134
},
3235

3336
create: (context) => {

src/rules/role-supports-aria-props.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
getPropValue,
1919
propName,
2020
} from 'jsx-ast-utils';
21+
import { generateObjSchema } from '../util/schemas';
2122
import getElementType from '../util/getElementType';
2223
import getImplicitRole from '../util/getImplicitRole';
2324

@@ -30,13 +31,15 @@ This role is implicit on the element ${tag}.`;
3031
return `The attribute ${attr} is not supported by the role ${role}.`;
3132
};
3233

34+
const schema = generateObjSchema();
35+
3336
export default {
3437
meta: {
3538
docs: {
3639
url: 'https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/HEAD/docs/rules/role-supports-aria-props.md',
3740
description: 'Enforce that elements with explicit or implicit roles defined contain only `aria-*` properties supported by that `role`.',
3841
},
39-
schema: [],
42+
schema: [schema],
4043
},
4144

4245
create(context) {

0 commit comments

Comments
 (0)