Skip to content

Commit

Permalink
fix new eslint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
kliesch committed Apr 19, 2024
1 parent e5ad511 commit 7ece6ce
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion itest/src/aut/ApplicationWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface HashParameter {
* @param value - value to validate
*/
const isAddressInfo = (value: unknown): value is Pick<AddressInfo, "port"> =>
typeof value === "object" && value !== null && value.hasOwnProperty("port");
typeof value === "object" && !!value?.hasOwnProperty("port");

/**
* Starts an HTTP server via Express, statically bound to the path of the
Expand Down
16 changes: 8 additions & 8 deletions packages/ckeditor5-bbcode/__tests__/bbob/Attributes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe("Attributes", () => {

it("should ignore invalid attributes, but process others", () => {
const el = document.createElement("div");
const invalidKey = "[invalid key]" as const;
const invalidKey = "[invalid key]";
const attrs: TagAttrs = {
class: "CLASS",
[invalidKey]: "INVALID",
Expand Down Expand Up @@ -89,7 +89,7 @@ describe("Attributes", () => {
});

it("should extract unique attribute, if it is the only attribute", () => {
const uniqueAttr = "https://example.org/" as const;
const uniqueAttr = "https://example.org/";
const attrs = {
// Typical representation of a URL, for example, in [url=https://example.org/].
[uniqueAttr]: uniqueAttr,
Expand All @@ -100,7 +100,7 @@ describe("Attributes", () => {
});

it("should extract unique attribute, and separate from others", () => {
const uniqueAttr = "https://example.org/" as const;
const uniqueAttr = "https://example.org/";
const otherAttrs = {
one: "1",
two: "2",
Expand Down Expand Up @@ -142,7 +142,7 @@ describe("Attributes", () => {

it("should use default unique attribute for empty attributes", () => {
const autCall = aut.callWithDefaultSupplied;
const uniqueKey = "unique" as const;
const uniqueKey = "unique";
const uniqueDefault = "uniqueDefault";
const result = autCall(uniqueKey, {}, uniqueDefault);
expect(result).toMatchObject({ [uniqueKey]: uniqueDefault });
Expand All @@ -154,19 +154,19 @@ describe("Attributes", () => {
${aut.callWithOverrideEnabled} | ${"call with override enabled"}
${aut.callWithDefaultSupplied} | ${"call with supplied default"}
`("[$#] should override from unique attributes: $callType", ({ autCall }: { autCall: AutCall }) => {
const uniqueKey = "unique" as const;
const uniqueKey = "unique";
const uniqueValueInAttrs = "uniqueValueInAttrs";
const uniqueValue = "uniqueValue" as const;
const uniqueValue = "uniqueValue";
const uniqueDefault = "uniqueDefault";
const result = autCall(uniqueKey, { [uniqueKey]: uniqueValueInAttrs, [uniqueValue]: uniqueValue }, uniqueDefault);
expect(result).toMatchObject({ [uniqueKey]: uniqueValue });
});

it("should prefer existing attribute, when override is disabled", () => {
const autCall = aut.callWithOverrideDisabled;
const uniqueKey = "unique" as const;
const uniqueKey = "unique";
const uniqueValueInAttrs = "uniqueValueInAttrs";
const uniqueValue = "uniqueValue" as const;
const uniqueValue = "uniqueValue";
const result = autCall(uniqueKey, { [uniqueKey]: uniqueValueInAttrs, [uniqueValue]: uniqueValue });

expect(result).toMatchObject({ [uniqueKey]: uniqueValueInAttrs });
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-bbcode/src/bbob/ckeditor5Preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const toNode = TagNode.create;
* efforts to prevent collisions with same-named tag-nodes within the
* original BBCode.
*/
const rootNodeName = "root" as const;
const rootNodeName = "root";

/**
* Wraps tree contents into an artificial root-node, that may then respect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { UriPath } from "@coremedia/ckeditor5-coremedia-studio-integration";
/**
* Default command name used to register at editor instance.
*/
export const openImageInTabCommandName = "openImageInTab" as const;
export const openImageInTabCommandName = "openImageInTab";

/**
* A command to open either a given URI path (on `execute`) or the URI path
Expand Down Expand Up @@ -54,7 +54,7 @@ export const registerOpenImageInTabCommand = (editor: Editor, name = openImageIn
*/
export const requireOpenImageInTabCommand = (
editor: Editor,
name = openImageInTabCommandName,
name: typeof openImageInTabCommandName = openImageInTabCommandName,
): OpenImageInTabCommand => {
const command = editor.commands.get(name);
if (!command) {
Expand All @@ -75,5 +75,5 @@ export const requireOpenImageInTabCommand = (
export const executeOpenImageInTabCommand = (
editor: Editor,
uriPaths: UriPath[] = [],
name = openImageInTabCommandName,
name: typeof openImageInTabCommandName = openImageInTabCommandName,
) => editor.commands.get(name)?.execute(...uriPaths);
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { UriPath } from "@coremedia/ckeditor5-coremedia-studio-integration";
/**
* Default command name used to register at editor instance.
*/
export const openContentInTabCommandName = "openContentInTab" as const;
export const openContentInTabCommandName = "openContentInTab";

/**
* A command to open either a given URI path (on `execute`) or the URI path
Expand Down Expand Up @@ -62,7 +62,7 @@ export const registerOpenContentInTabCommand = (editor: Editor, name = openConte
export const executeOpenContentInTabCommand = (
editor: Editor,
uriPaths: UriPath[] = [],
name = openContentInTabCommandName,
name: typeof openContentInTabCommandName = openContentInTabCommandName,
) => editor.commands.get(name)?.execute(...uriPaths);

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-coremedia-richtext/src/Strictness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ export type ActiveStrictnessKey = Exclude<StrictnessKey, "NONE">;
*
* Default changed from `Strictness.STRICT` to `Strictness.LOOSE` in v11.
*/
export const defaultStrictness = Strictness.LOOSE as const;
export const defaultStrictness = Strictness.LOOSE;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { isHTMLAnchorElement } from "@coremedia/ckeditor5-dom-support/src/HTMLAn
import { ConversionApi } from "@coremedia/ckeditor5-dom-converter/src/ConversionApi";
import { RequireSelected } from "@coremedia/ckeditor5-common";

export const contentUriPathPrefix = "content" as const;
export const contentUriPathPrefix = "content";

/**
* Pattern for extracting ID (group: `id`) from the link as represented in data.
Expand Down
4 changes: 2 additions & 2 deletions packages/ckeditor5-coremedia-richtext/src/rules/XLink.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { capitalize } from "@coremedia/ckeditor5-common/src/Strings";
import { describeAttr } from "@coremedia/ckeditor5-dom-support";

export const xLinkNamespaceUri = "http://www.w3.org/1999/xlink" as const;
export const xLinkPrefix = "xlink" as const;
export const xLinkNamespaceUri = "http://www.w3.org/1999/xlink";
export const xLinkPrefix = "xlink";
export const xLinkAttributes = ["type", "href", "role", "title", "show", "actuate"];
export type XLinkAttributeKey = (typeof xLinkAttributes)[number];
export type XLinkAttributes = Partial<Record<XLinkAttributeKey, string>>;
Expand Down

0 comments on commit 7ece6ce

Please sign in to comment.