ESLint: Add new rules (#616)

This commit is contained in:
Aki Hamano 2024-05-06 12:49:30 +09:00 committed by GitHub
parent 17121fcea7
commit 59c3aac75e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 71 additions and 6 deletions

View file

@ -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" ],

View file

@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useState } from '@wordpress/element';
import { useDispatch, useSelect } from '@wordpress/data';
@ -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 } ) => {

View file

@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useState } from '@wordpress/element';
import { useDispatch } from '@wordpress/data';
@ -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 = () => {

View file

@ -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 } ) => {
@ -34,7 +45,7 @@ const ThemeJsonEditorModal = ( { onRequestClose } ) => {
extensions={ [ json() ] }
value={ themeData }
onChange={ handleSave }
readOnly={ true }
readOnly
/>
</Modal>
);

View file

@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { useState } from '@wordpress/element';
import { useSelect, useDispatch } from '@wordpress/data';
@ -15,6 +18,10 @@ import {
TextareaControl,
ExternalLink,
} from '@wordpress/components';
/**
* Internal dependencies
*/
import { postUpdateThemeMetadata } from '../resolvers';
export const ThemeMetadataEditorModal = ( { onRequestClose } ) => {
@ -92,7 +99,7 @@ export const ThemeMetadataEditorModal = ( { onRequestClose } ) => {
</Text>
<Spacer />
<TextControl
disabled={ true }
disabled
label={ __( 'Theme name', 'create-block-theme' ) }
value={ theme.name }
/>

View file

@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { useSelect, useDispatch } from '@wordpress/data';
import { store as noticesStore } from '@wordpress/notices';
@ -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';

View file

@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import {
// eslint-disable-next-line
__experimentalHStack as HStack,

View file

@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import { useState } from '@wordpress/element';
import { registerPlugin } from '@wordpress/plugins';
import { PluginSidebar, PluginSidebarMoreMenuItem } from '@wordpress/edit-site';
@ -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';

View file

@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import apiFetch from '@wordpress/api-fetch';
export async function fetchThemeJson() {

View file

@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import apiFetch from '@wordpress/api-fetch';
async function loadUnavailableThemeNames() {

View file

@ -1,4 +1,8 @@
/* eslint-disable no-console */
/**
* External dependencies
*/
const fs = require( 'fs' );
const core = require( '@actions/core' );
const simpleGit = require( 'simple-git' );

View file

@ -1,5 +1,5 @@
/**
* WordPress Dependencies
* WordPress dependencies
*/
const defaultConfig = require( '@wordpress/scripts/config/webpack.config.js' );