Skip to content

Commit

Permalink
ESLint: Add new rules (#616)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano authored May 6, 2024
1 parent 17121fc commit 59c3aac
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
"FileReader": true,
"FontFace": true
},
"rules": {
"@wordpress/dependency-group": "error",
"@wordpress/i18n-text-domain": [
"error",
{
"allowedTextDomain": "create-block-theme"
}
],
"react/jsx-boolean-value": "error"
},
"overrides": [
{
"files": [ "**/test/**/*.js" ],
Expand Down
6 changes: 6 additions & 0 deletions src/editor-sidebar/create-panel.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useState } from '@wordpress/element';
import { useDispatch, useSelect } from '@wordpress/data';
Expand All @@ -21,6 +24,9 @@ import {
} from '@wordpress/components';
import { addCard, copy } from '@wordpress/icons';

/**
* Internal dependencies
*/
import ScreenHeader from './screen-header';

export const CreateThemePanel = ( { createType } ) => {
Expand Down
8 changes: 7 additions & 1 deletion src/editor-sidebar/create-variation-panel.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useState } from '@wordpress/element';
import { useDispatch } from '@wordpress/data';
Expand All @@ -16,8 +19,11 @@ import {
TextControl,
} from '@wordpress/components';
import { copy } from '@wordpress/icons';
import { postCreateThemeVariation } from '../resolvers';

/**
* Internal dependencies
*/
import { postCreateThemeVariation } from '../resolvers';
import ScreenHeader from './screen-header';

export const CreateVariationPanel = () => {
Expand Down
17 changes: 14 additions & 3 deletions src/editor-sidebar/json-editor-modal.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
/**
* External dependencies
*/
import CodeMirror from '@uiw/react-codemirror';
import { json } from '@codemirror/lang-json';

/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { useState, useEffect } from '@wordpress/element';
import { Modal } from '@wordpress/components';
import { useSelect } from '@wordpress/data';
import CodeMirror from '@uiw/react-codemirror';
import { json } from '@codemirror/lang-json';

/**
* Internal dependencies
*/
import { fetchThemeJson } from '../resolvers';

const ThemeJsonEditorModal = ( { onRequestClose } ) => {
Expand Down Expand Up @@ -34,7 +45,7 @@ const ThemeJsonEditorModal = ( { onRequestClose } ) => {
extensions={ [ json() ] }
value={ themeData }
onChange={ handleSave }
readOnly={ true }
readOnly
/>
</Modal>
);
Expand Down
9 changes: 8 additions & 1 deletion src/editor-sidebar/metadata-editor-modal.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { useState } from '@wordpress/element';
import { useSelect, useDispatch } from '@wordpress/data';
Expand All @@ -15,6 +18,10 @@ import {
TextareaControl,
ExternalLink,
} from '@wordpress/components';

/**
* Internal dependencies
*/
import { postUpdateThemeMetadata } from '../resolvers';

export const ThemeMetadataEditorModal = ( { onRequestClose } ) => {
Expand Down Expand Up @@ -92,7 +99,7 @@ export const ThemeMetadataEditorModal = ( { onRequestClose } ) => {
</Text>
<Spacer />
<TextControl
disabled={ true }
disabled
label={ __( 'Theme name', 'create-block-theme' ) }
value={ theme.name }
/>
Expand Down
6 changes: 6 additions & 0 deletions src/editor-sidebar/save-panel.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useSelect, useDispatch } from '@wordpress/data';
import { store as noticesStore } from '@wordpress/notices';
Expand All @@ -16,6 +19,9 @@ import {
import { archive } from '@wordpress/icons';
import { store as preferencesStore } from '@wordpress/preferences';

/**
* Internal dependencies
*/
import ScreenHeader from './screen-header';

const PREFERENCE_SCOPE = 'create-block-theme';
Expand Down
3 changes: 3 additions & 0 deletions src/editor-sidebar/screen-header.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import {
// eslint-disable-next-line
__experimentalHStack as HStack,
Expand Down
6 changes: 6 additions & 0 deletions src/plugin-sidebar.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import { useState } from '@wordpress/element';
import { registerPlugin } from '@wordpress/plugins';
import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-site';
Expand Down Expand Up @@ -39,6 +42,9 @@ import {
blockMeta,
} from '@wordpress/icons';

/**
* Internal dependencies
*/
import { CreateThemePanel } from './editor-sidebar/create-panel';
import ThemeJsonEditorModal from './editor-sidebar/json-editor-modal';
import { SaveThemePanel } from './editor-sidebar/save-panel';
Expand Down
3 changes: 3 additions & 0 deletions src/resolvers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import apiFetch from '@wordpress/api-fetch';

export async function fetchThemeJson() {
Expand Down
3 changes: 3 additions & 0 deletions src/wp-org-theme-directory.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import apiFetch from '@wordpress/api-fetch';

async function loadUnavailableThemeNames() {
Expand Down
4 changes: 4 additions & 0 deletions update-version-and-changelog.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/* eslint-disable no-console */

/**
* External dependencies
*/
const fs = require( 'fs' );
const core = require( '@actions/core' );
const simpleGit = require( 'simple-git' );
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* WordPress Dependencies
* WordPress dependencies
*/
const defaultConfig = require( '@wordpress/scripts/config/webpack.config.js' );

Expand Down

0 comments on commit 59c3aac

Please sign in to comment.