Skip to content

Commit

Permalink
Flow: upgrade to version 0.191.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnzlml authored and kodiakhq[bot] committed Nov 4, 2022
1 parent 7eecbba commit 779ed4c
Show file tree
Hide file tree
Showing 17 changed files with 38 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"babel-loader": "^8.3.0",
"eslint": "^8.26.0",
"eslint-formatter-codeframe": "^7.32.1",
"flow-bin": "^0.189.0",
"flow-bin": "^0.191.0",
"glob": "^8.0.3",
"hermes-eslint": "^0.9.0",
"jest": "^29.2.2",
Expand Down
2 changes: 1 addition & 1 deletion src/abacus-backoffice/src/d3/BarChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Props = {

export default function BarChart(props: Props): Node {
const svg = React.useRef(null);
const [width, setWidth] = useState(null);
const [width, setWidth] = useState<null | number>(null);

React.useEffect(() => {
if (width != null) {
Expand Down
2 changes: 1 addition & 1 deletion src/abacus-backoffice/src/pos/ProductsGridCategories.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import ProductsGrid from './ProductsGrid';
* for the first category (or for the selected category).
*/
export default function ProductsGridCategories(): Node {
const [selectedCategory, setSelectedCategory] = useState(null);
const [selectedCategory, setSelectedCategory] = useState<null | string>(null);

const applicationLocale = useApplicationLocale();
// eslint-disable-next-line relay/generated-flow-types -- https://github.com/relayjs/eslint-plugin-relay/issues/131
Expand Down
2 changes: 1 addition & 1 deletion src/abacus-backoffice/src/products/ProductsEditLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type Props = {

export default function ProductsEditLayout(props: Props): Node {
const applicationLocale = useApplicationLocale();
const [imagesToDelete, setImagesToDelete] = useState([]);
const [imagesToDelete, setImagesToDelete] = useState<Array<string>>([]);

// eslint-disable-next-line relay/generated-flow-types -- https://github.com/relayjs/eslint-plugin-relay/issues/131
const data = useLazyLoadQuery(
Expand Down
2 changes: 1 addition & 1 deletion src/abacus-docs/components/Shell/ThemeToggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const moon = (
);

export function ThemeToggle(): Node {
const [theme, setTheme] = React.useState(undefined);
const [theme, setTheme] = React.useState<void | string>(undefined);
const [, setHovering] = React.useState(false);

function setPreferredTheme(newTheme: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class Alphabet1 extends Component<AplhabetProps, AplhabetState> {
}

export function Alphabet2(): Element<'div'> {
const [justClicked, updateJustClicked] = useState(null);
const [justClicked, updateJustClicked] = useState<null | string>(null);
const letters = Array.from({ length: 26 }, (_, i) => String.fromCharCode(A + i));

const handleClick = (letter: string) => {
Expand Down
9 changes: 9 additions & 0 deletions src/eslint-config-adeira/src/changeNextVersionErrorLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,19 @@ module.exports = function changeNextVersionErrorLevel(
return Object.entries(config).reduce((acc, [ruleName, value]) => {
if (Array.isArray(value) && value[0] === 3) {
const [, ...config] = value;
/* $FlowFixMe[prop-missing] This comment suppresses an error when
* upgrading Flow to version 0.191.0. To see the error delete this
* comment and run Flow. */
acc[ruleName] = [level, ...config];
} else if (value === 3) {
/* $FlowFixMe[prop-missing] This comment suppresses an error when
* upgrading Flow to version 0.191.0. To see the error delete this
* comment and run Flow. */
acc[ruleName] = level;
} else {
/* $FlowFixMe[prop-missing] This comment suppresses an error when
* upgrading Flow to version 0.191.0. To see the error delete this
* comment and run Flow. */
acc[ruleName] = value;
}
return acc;
Expand Down
2 changes: 1 addition & 1 deletion src/eslint-plugin-sx/src/getRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const DEFAULT_RULES_PATH = path.join(__dirname, 'rules');
module.exports = function getRules(
rulesPath /*: string */ = DEFAULT_RULES_PATH,
) /*: { +[ruleName: string]: string } */ {
const rules = {};
const rules /*: { [string]: $FlowFixMe } */ = {};
for (const dirent of fs.readdirSync(rulesPath, {
encoding: 'utf8',
withFileTypes: true,
Expand Down
3 changes: 3 additions & 0 deletions src/flow-config-parser/src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export default function parse(input: string): ParsedConfig {
const rawValue = keyValueMatch.groups?.rawValue;
const key = rawKey?.trim();
if (parsedConfig[currentSection] === null) {
/* $FlowFixMe[prop-missing] This comment suppresses an error when
* upgrading Flow to version 0.191.0. To see the error delete this
* comment and run Flow. */
parsedConfig[currentSection] = {};
}
if (KNOWN_LIST_OPTIONS.includes(key)) {
Expand Down
5 changes: 4 additions & 1 deletion src/forms/src/FormRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export default function FormRoot(props: Props): React.Element<'form'> {
formFields: {
...prevState.formFields,
[inputName]: {
/* $FlowFixMe[incompatible-type] This comment suppresses an
* error when upgrading Flow to version 0.191.0. To see the
* error delete this comment and run Flow. */
...prevState.formFields[inputName],
inputValue,
validationError,
Expand All @@ -82,7 +85,7 @@ export default function FormRoot(props: Props): React.Element<'form'> {
},
unmaskFormFieldErrors: () => {
setContextState((prevState) => {
const formFields = {};
const formFields: { [empty]: any } = {};
Object.keys(prevState.formFields).forEach((inputName) => {
formFields[inputName] = {
...prevState.formFields[inputName],
Expand Down
3 changes: 3 additions & 0 deletions src/relay/src/RelayRehydratePreloadedQueries.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export default function RelayRehydratePreloadedQueries({ Component, pageProps }:
// $FlowFixMe[prop-missing]: property responseCache is missing in INetwork
environment.getNetwork().responseCache.set(params.cacheID, variables, response);

/* $FlowFixMe[prop-missing] This comment suppresses an error when
* upgrading Flow to version 0.191.0. To see the error delete this
* comment and run Flow. */
relayPreloadedQueryRefs[queryName] = {
environment,
fetchKey: params.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ it('returns request body without uploadables - persistent queries', () => {
});

function serializeFormData(formData: FormData) {
const object = {};
const object: { [string]: FormDataEntryValue } = {};
for (const [key, value] of formData.entries()) {
object[key] = value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/sx-design/src/Skeleton/Skeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Props = {
*/
export default function Skeleton(props: Props): Node {
const childrenRef = useRef(null);
const [childrenRect, setChildrenRect] = useState(null);
const [childrenRect, setChildrenRect] = useState<null | { height: number, width: number }>(null);

if (props.show != null) {
// Property `show` makes only sense when there is a children. It's commonly used for hiding the
Expand Down
2 changes: 1 addition & 1 deletion src/sx-design/src/Tabs/__tests__/Tabs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function TestComponentFruits() {
}

function TestComponentNumbers() {
const [selected, setSelected] = useState(null);
const [selected, setSelected] = useState<null | number>(null);
return (
<Tabs
selected={selected}
Expand Down
2 changes: 1 addition & 1 deletion src/sx/src/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default function create<T: SheetDefinitions>(sheetDefinitions: T): Create
);
}

const selectedStyles = {};
const selectedStyles: { [string]: void | string } = {};
for (const sheetDefinitionName of sheetDefinitionNames) {
if (sheetDefinitionName != null && sheetDefinitionName !== false) {
invariant(
Expand Down
3 changes: 3 additions & 0 deletions src/sx/src/css-properties/isUnitlessNumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ function prefixKey(prefix: string, key: string) {
const prefixes = ['webkit'];
Object.keys(isUnitlessNumber).forEach(function (prop) {
prefixes.forEach(function (prefix) {
/* $FlowFixMe[prop-missing] This comment suppresses an error when upgrading
* Flow to version 0.191.0. To see the error delete this comment and run
* Flow. */
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10386,12 +10386,12 @@ __metadata:
languageName: node
linkType: hard

"flow-bin@npm:^0.189.0":
version: 0.189.0
resolution: "flow-bin@npm:0.189.0"
"flow-bin@npm:^0.191.0":
version: 0.191.0
resolution: "flow-bin@npm:0.191.0"
bin:
flow: cli.js
checksum: 85202fd7f4c7c4401f66b36b32589e7a7d67ab2646411f934c7799d09813dc17608f2d80bbd95125c1c274b13075bea94337e0672a73dfb581fde89e43c8a2a4
checksum: 84b3ba07521c2253d069e090fb3a076371ee4926b78bdbc241a32ed725a1bf19656ed9831367c1e8f93884f893548649cd069bd3d6f4f08523b5fa97bf1e0b96
languageName: node
linkType: hard

Expand Down Expand Up @@ -17333,7 +17333,7 @@ __metadata:
babel-loader: ^8.3.0
eslint: ^8.26.0
eslint-formatter-codeframe: ^7.32.1
flow-bin: ^0.189.0
flow-bin: ^0.191.0
glob: ^8.0.3
hermes-eslint: ^0.9.0
jest: ^29.2.2
Expand Down

0 comments on commit 779ed4c

Please sign in to comment.