Skip to content

Commit db8daf6

Browse files
committed
Fix inspection warnings.
1 parent 9b5af4b commit db8daf6

22 files changed

+54
-81
lines changed

src/js/components/EditorSidebar/EditorSidebar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Dispatch, SetStateAction } from 'react'
1+
import React from 'react'
22
import { Spinner } from '@wordpress/components'
33
import { isRTL } from '@wordpress/i18n'
44
import { useSnippetForm } from '../../hooks/useSnippetForm'
@@ -16,6 +16,7 @@ import { ActivationSwitch } from './controls/ActivationSwitch'
1616
import { DeleteButton } from './actions/DeleteButton'
1717
import { PriorityInput } from './controls/PriorityInput'
1818
import { RTLControl } from './controls/RTLControl'
19+
import type { Dispatch, SetStateAction } from 'react'
1920

2021
export interface EditorSidebarProps {
2122
setIsUpgradeDialogOpen: Dispatch<SetStateAction<boolean>>

src/js/components/EditorSidebar/controls/PriorityInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { __, _x } from '@wordpress/i18n'
2+
import { __ } from '@wordpress/i18n'
33
import { useSnippetForm } from '../../../hooks/useSnippetForm'
44
import { Tooltip } from '../../common/Tooltip'
55

src/js/components/common/Badge.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import React, { ReactNode } from 'react'
1+
import React from 'react'
22
import classnames from 'classnames'
3+
import type { ReactNode } from 'react'
34
import type { SnippetType } from '../../types/Snippet'
45

56
export type BadgeName = SnippetType | 'core' | 'pro' | 'ai' | 'cloud' | 'bundles' | 'cloud_search' | 'beta'
@@ -22,7 +23,5 @@ export const Badge: React.FC<BadgeProps> = ({ name, small, inverted, children })
2223
<span className={classnames('badge', `${name}-badge`, { 'small-badge': small, 'inverted-badge': inverted })}>
2324
{badgeIcons[name]
2425
? <span className={`dashicons dashicons-${badgeIcons[name]}`} />
25-
: children ?
26-
children
27-
: name}
26+
: children ?? name}
2827
</span>

src/js/components/common/CopyToClipboardButton.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { Spinner } from '@wordpress/components'
22
import { __ } from '@wordpress/i18n'
33
import React, { useState } from 'react'
4-
import { Button, ButtonProps } from './Button'
4+
import { Button } from './Button'
55
import { CopyIcon } from './icons/CopyIcon'
6+
import type { ButtonProps } from './Button'
67

78
const TIMEOUT = 1500
89

src/js/hooks/useAxios.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/js/services/manage/requests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { SnippetSchema } from '../../types/schema/SnippetSchema'
21
import { isNetworkAdmin } from '../../utils/screen'
2+
import type { SnippetSchema } from '../../types/schema/SnippetSchema'
33
import type { Snippet, SnippetScope } from '../../types/Snippet'
44

55
export interface ResponseData<T = unknown> {
@@ -46,7 +46,7 @@ export const updateSnippet = (field: keyof Snippet, row: Element, snippet: Parti
4646
const updatedSnippet: Partial<SnippetSchema> = {
4747
id: parseInt(columnId.textContent, 10),
4848
shared_network: null !== /\bshared-network-snippet\b/.exec(row.className),
49-
network: snippet.shared_network || isNetworkAdmin(),
49+
network: snippet.shared_network ?? isNetworkAdmin(),
5050
scope: <SnippetScope | null> row.getAttribute('data-snippet-scope') ?? snippet.scope,
5151
...snippet
5252
}

src/js/utils/restAPI.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { trimTrailingChar } from './text'
22
import type { AxiosRequestConfig } from 'axios'
33

4-
export const REST_BASE = trimTrailingChar(window.CODE_SNIPPETS?.restAPI.base ?? '', '/')
54
export const REST_SNIPPETS_BASE = trimTrailingChar(window.CODE_SNIPPETS?.restAPI.snippets ?? '', '/')
65

76
export const REST_API_AXIOS_CONFIG: AxiosRequestConfig = {

src/php/admin-menus/class-edit-menu.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class Edit_Menu extends Admin_Menu {
1212
/**
1313
* Handle for JavaScript asset file.
1414
*/
15-
const JS_HANDLE = 'code-snippets-edit-menu';
15+
public const JS_HANDLE = 'code-snippets-edit-menu';
1616

1717
/**
1818
* Handle for CSS asset file.
1919
*/
20-
const CSS_HANDLE = 'code-snippets-edit';
20+
public const CSS_HANDLE = 'code-snippets-edit';
2121

2222
/**
2323
* The snippet object currently being edited

src/php/admin-menus/class-manage-menu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function run() {
5151

5252
add_action( 'admin_menu', array( $this, 'register_upgrade_menu' ), 500 );
5353
add_filter( 'set-screen-option', array( $this, 'save_screen_option' ), 10, 3 );
54+
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_menu_css' ] );
5455
add_action( 'wp_ajax_update_code_snippet', array( $this, 'ajax_callback' ) );
5556
}
5657

@@ -99,7 +100,6 @@ public function register_upgrade_menu() {
99100
);
100101

101102
add_action( "load-$hook", [ $this, 'load_upgrade_menu' ] );
102-
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_menu_css' ] );
103103
}
104104

105105
/**

src/php/admin-menus/class-settings-menu.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Settings_Menu extends Admin_Menu {
1717
/**
1818
* Settings page name as registered with the Settings API.
1919
*/
20-
const SETTINGS_PAGE = 'code-snippets';
20+
public const SETTINGS_PAGE = 'code-snippets';
2121

2222
/**
2323
* Constructor

0 commit comments

Comments
 (0)