Skip to content

Commit 9ff0f5f

Browse files
talentlessguyljharb
authored andcommitted
[flow] update flow so there are no errors
1 parent 0298c54 commit 9ff0f5f

14 files changed

+23
-19
lines changed

__mocks__/genInteractives.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export function genInteractiveElements(): Array<JSXElementMockType> {
170170
if (bracketIndex > -1) {
171171
name = elementSymbol.slice(0, bracketIndex);
172172
}
173-
const attributes = interactiveElementsMap[elementSymbol].map(({ prop, value }) => JSXAttributeMock(prop, value));
173+
const attributes = interactiveElementsMap[(elementSymbol: any)].map(({ prop, value }) => JSXAttributeMock(prop, value));
174174
return JSXElementMock(name, attributes);
175175
});
176176
}

__tests__/__util__/ruleOptionsMapperFactory.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function ruleOptionsMapperFactory(ruleOptions: Array<mixed> = [])
2323
code,
2424
errors,
2525
// Flatten the array of objects in an array of one object.
26-
options: [fromEntries((options || []).concat(ruleOptions).flatMap((item) => entries(item)))],
26+
options: [fromEntries((options || []).concat(ruleOptions).flatMap((item) => entries((item: any))))],
2727
parserOptions,
2828
settings,
2929
};

flow/eslint.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
export type ESLintReport = {
55
node: any,
66
message: string,
7+
data?: any
78
};
89

910
export type ESLintSettings = {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"eslint-plugin-flowtype": "^5.8.0 || ^8.0.3",
5757
"eslint-plugin-import": "^2.31.0",
5858
"estraverse": "^5.3.0",
59-
"flow-bin": "^0.147.0",
59+
"flow-bin": "^0.250.0",
6060
"in-publish": "^2.0.1",
6161
"jackspeak": "=2.1.1",
6262
"jscodeshift": "^17.0.0",

src/rules/anchor-ambiguous-text.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// ----------------------------------------------------------------------------
88
// Rule Definition
99
// ----------------------------------------------------------------------------
10-
1110
import type { ESLintConfig, ESLintContext } from '../../flow/eslint';
1211
import { arraySchema, generateObjSchema } from '../util/schemas';
1312
import getAccessibleChildText from '../util/getAccessibleChildText';
@@ -44,7 +43,7 @@ export default ({
4443
const ambiguousWords = new Set(words);
4544

4645
return {
47-
JSXOpeningElement: (node) => {
46+
JSXOpeningElement: (node: any) => {
4847
const nodeType = elementType(node);
4948

5049
// Only check anchor elements and custom types.

src/rules/anchor-is-valid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default ({
6060

6161
// Create active aspect flag object. Failing checks will only report
6262
// if the related flag is set to true.
63-
const activeAspects = {};
63+
const activeAspects: Object = {};
6464
allAspects.forEach((aspect) => {
6565
activeAspects[aspect] = aspects.indexOf(aspect) !== -1;
6666
});

src/rules/control-has-associated-label.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
import { getProp, getLiteralPropValue } from 'jsx-ast-utils';
1313
import type { JSXElement } from 'ast-types-flow';
1414
import { generateObjSchema, arraySchema } from '../util/schemas';
15-
import type { ESLintConfig, ESLintContext, ESLintVisitorSelectorConfig } from '../../flow/eslint';
15+
import type {
16+
ESLintConfig,
17+
ESLintContext,
18+
ESLintVisitorSelectorConfig,
19+
} from '../../flow/eslint';
1620
import getElementType from '../util/getElementType';
1721
import isDOMElement from '../util/isDOMElement';
1822
import isHiddenFromScreenReader from '../util/isHiddenFromScreenReader';

src/rules/label-has-associated-control.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const schema = generateObjSchema({
3636
},
3737
});
3838

39-
function validateID(node, context) {
39+
function validateID(node: Object, context: Object) {
4040
const { settings } = context;
4141
const htmlForAttributes = settings['jsx-a11y']?.attributes?.for ?? ['htmlFor'];
4242

src/rules/media-has-caption.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ const schema = generateObjSchema({
2525
track: arraySchema,
2626
});
2727

28-
const isMediaType = (context, type) => {
28+
const isMediaType = (context: Object, type: string) => {
2929
const options = context.options[0] || {};
3030
return MEDIA_TYPES
3131
.concat(MEDIA_TYPES.flatMap((mediaType) => options[mediaType]))
3232
.some((typeToCheck) => typeToCheck === type);
3333
};
3434

35-
const isTrackType = (context, type) => {
35+
const isTrackType = (context: Object, type: string) => {
3636
const options = context.options[0] || {};
3737
return ['track'].concat(options.track || []).some((typeToCheck) => typeToCheck === type);
3838
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default ({
4040
},
4141

4242
create: (context: ESLintContext) => ({
43-
JSXOpeningElement: (node) => {
43+
JSXOpeningElement: (node: Object) => {
4444
const { name } = node.name;
4545

4646
if (!dom.get(name)) {

0 commit comments

Comments
 (0)