Fix symbol-description ESLint rule (#3954)

* Add symbol descriptions

* Set symbol-description to error & bump migration

* add changeset
This commit is contained in:
Michał Droń 2023-07-19 15:13:35 +02:00 committed by GitHub
parent c99fa1c5a0
commit fa0e142829
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 24 additions and 21 deletions

View file

@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---
Fix symbol-description ESLint rule

View file

@ -111,8 +111,7 @@
"no-useless-escape": "off", "no-useless-escape": "off",
"prefer-promise-reject-errors": "off", "prefer-promise-reject-errors": "off",
"react/display-name": "off", "react/display-name": "off",
"react/jsx-key": "off", "react/jsx-key": "warn"
"symbol-description": "warn"
}, },
"ignorePatterns": ["node_modules/", "**/types/**/*", "type-policies.ts"] "ignorePatterns": ["node_modules/", "**/types/**/*", "type-policies.ts"]
} }

View file

@ -1,2 +1,2 @@
export const COLLECTION_DETAILS_FORM_ID = Symbol(); export const COLLECTION_DETAILS_FORM_ID = Symbol("collection-details-form-id");
export const COLLECTION_CREATE_FORM_ID = Symbol(); export const COLLECTION_CREATE_FORM_ID = Symbol("collection-create-form-id");

View file

@ -10,7 +10,7 @@ import React from "react";
import { Locale } from "../../Locale"; import { Locale } from "../../Locale";
export const numberCellEmptyValue = Symbol(); export const numberCellEmptyValue = Symbol("number-cell-empty-value");
interface NumberCellProps { interface NumberCellProps {
readonly kind: "number-cell"; readonly kind: "number-cell";
readonly value: number | typeof numberCellEmptyValue; readonly value: number | typeof numberCellEmptyValue;

View file

@ -1,4 +1,3 @@
// @ts-strict-ignore
import React, { useContext, useRef } from "react"; import React, { useContext, useRef } from "react";
import { ExitFormDialogContext } from "./ExitFormDialogProvider"; import { ExitFormDialogContext } from "./ExitFormDialogProvider";
@ -12,14 +11,14 @@ export interface UseExitFormDialogResult
} }
export interface UseExitFormDialogProps { export interface UseExitFormDialogProps {
formId: symbol; formId: symbol | undefined;
isDisabled?: boolean; isDisabled?: boolean;
} }
export const useExitFormDialog = ( export const useExitFormDialog = (
{ formId, isDisabled }: UseExitFormDialogProps = { formId: undefined }, { formId, isDisabled }: UseExitFormDialogProps = { formId: undefined },
): UseExitFormDialogResult => { ): UseExitFormDialogResult => {
const id = useRef(formId || Symbol()).current; const id = useRef(formId || Symbol("exit-form-fallback-id")).current;
const exitDialogProps = useContext(ExitFormDialogContext); const exitDialogProps = useContext(ExitFormDialogContext);
const { setIsDirty, setIsSubmitDisabled, setExitDialogSubmitRef } = const { setIsDirty, setIsSubmitDisabled, setExitDialogSubmitRef } =

View file

@ -1 +1 @@
export const SALE_CREATE_FORM_ID = Symbol(); export const SALE_CREATE_FORM_ID = Symbol("sale-create-form-id");

View file

@ -1 +1 @@
export const SALE_UPDATE_FORM_ID = Symbol(); export const SALE_UPDATE_FORM_ID = Symbol("sale-update-form-id");

View file

@ -1 +1 @@
export const VOUCHER_CREATE_FORM_ID = Symbol(); export const VOUCHER_CREATE_FORM_ID = Symbol("voucher-create-form-id");

View file

@ -1 +1 @@
export const VOUCHER_UPDATE_FORM_ID = Symbol(); export const VOUCHER_UPDATE_FORM_ID = Symbol("voucher-update-form-id");

View file

@ -27,7 +27,7 @@ describe("useChannels", () => {
closeModal: jest.fn, closeModal: jest.fn,
openModal: jest.fn, openModal: jest.fn,
}, },
{ formId: Symbol() }, { formId: Symbol("channel-test-form-id") },
), ),
); );
@ -54,7 +54,7 @@ describe("useChannels", () => {
closeModal: jest.fn, closeModal: jest.fn,
openModal: jest.fn, openModal: jest.fn,
}, },
{ formId: Symbol() }, { formId: Symbol("channel-test-form-id") },
), ),
); );
@ -85,7 +85,7 @@ describe("useChannels", () => {
closeModal: jest.fn, closeModal: jest.fn,
openModal: jest.fn, openModal: jest.fn,
}, },
{ formId: Symbol() }, { formId: Symbol("channel-test-form-id") },
), ),
); );

View file

@ -1 +1 @@
export const PRODUCT_CREATE_FORM_ID = Symbol(); export const PRODUCT_CREATE_FORM_ID = Symbol("product-create-form-id");

View file

@ -1,3 +1,3 @@
export const CHANNELS_AVAILIABILITY_MODAL_SELECTOR = "open-channels-picker"; export const CHANNELS_AVAILIABILITY_MODAL_SELECTOR = "open-channels-picker";
export const PRODUCT_UPDATE_FORM_ID = Symbol(); export const PRODUCT_UPDATE_FORM_ID = Symbol("product-update-form-id");

View file

@ -42,7 +42,7 @@ const defaultChannels = [
const props: ShippingZoneRatesCreatePageProps = { const props: ShippingZoneRatesCreatePageProps = {
backUrl: "", backUrl: "",
formId: Symbol(), formId: Symbol("shipping-zone-rates-create-form-id"),
allChannelsCount: 3, allChannelsCount: 3,
channelErrors: [], channelErrors: [],
disabled: false, disabled: false,

View file

@ -64,7 +64,7 @@ const props: ShippingZoneRatesPageProps = {
toggleAll: () => undefined, toggleAll: () => undefined,
toolbar: () => undefined, toolbar: () => undefined,
variant: ShippingMethodTypeEnum.PRICE, variant: ShippingMethodTypeEnum.PRICE,
formId: Symbol(), formId: Symbol("shipping-zone-rates-details-form-id"),
taxClasses, taxClasses,
fetchMoreTaxClasses: undefined, fetchMoreTaxClasses: undefined,
}; };

View file

@ -30,7 +30,7 @@ import createDialogActionHandlers from "@dashboard/utils/handlers/dialogActionHa
import React from "react"; import React from "react";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
const FORM_ID = Symbol(); const FORM_ID = Symbol("shipping-zone-rates-create-form-id");
export interface RateCreateProps { export interface RateCreateProps {
id: string; id: string;

View file

@ -61,7 +61,7 @@ import { mapEdgesToItems } from "@dashboard/utils/maps";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
const FORM_ID = Symbol(); const FORM_ID = Symbol("shipping-zone-rates-details-form-id");
export interface RateUpdateProps { export interface RateUpdateProps {
id: string; id: string;