Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eslint: Remove eslint-plugin-wpcalypso, add more @wordpress rules, and clean up #38436

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 0 additions & 44 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Replace eslint disable of `wpcalypso/no-unsafe-wp-apis` with `@wordpress/no-unsafe-wp-apis`. No change to functionality.


Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Button } from '@automattic/jetpack-components';
// eslint-disable-next-line wpcalypso/no-unsafe-wp-apis
import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components'; // eslint-disable-line @wordpress/no-unsafe-wp-apis
import { useDispatch, useSelect } from '@wordpress/data';
import { createInterpolateElement, useCallback, useReducer } from '@wordpress/element';
import { __, _x, sprintf } from '@wordpress/i18n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { Button, useGlobalNotices } from '@automattic/jetpack-components';
import {
BaseControl,
FlexBlock,
// eslint-disable-next-line wpcalypso/no-unsafe-wp-apis
__experimentalHStack as HStack,
__experimentalHStack as HStack, // eslint-disable-line @wordpress/no-unsafe-wp-apis
} from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { useCallback, useMemo } from '@wordpress/element';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable wpcalypso/no-unsafe-wp-apis */
import { useGlobalNotices } from '@automattic/jetpack-components';
import {
PanelBody,
ToggleControl,
Button,
__experimentalHStack as HStack,
__experimentalHStack as HStack, // eslint-disable-line @wordpress/no-unsafe-wp-apis
} from '@wordpress/components';
import { useCallback, useState, Fragment } from '@wordpress/element';
import { __, _x } from '@wordpress/i18n';
Expand Down
5 changes: 5 additions & 0 deletions projects/packages/forms/changelog/remove-calypso-eslint
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Replace eslint disable of `wpcalypso/no-unsafe-wp-apis` with `@wordpress/no-unsafe-wp-apis`. No change to functionality.


5 changes: 5 additions & 0 deletions projects/packages/forms/changelog/remove-calypso-eslint#2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: removed
Comment: Remove `wpcalypso/jsx-classname-namespace` from eslint config, eslint-plugin-wpcalypso is being removed.


1 change: 0 additions & 1 deletion projects/packages/forms/src/blocks/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module.exports = {
'react/react-in-jsx-scope': 0,
'space-unary-ops': 0,
'space-before-function-paren': 0,
'wpcalypso/jsx-classname-namespace': 0,

// eslint 6.x migration
'react-hooks/rules-of-hooks': 1,
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/forms/src/blocks/contact-form/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
InnerBlocks,
InspectorControls,
URLInput,
__experimentalBlockVariationPicker as BlockVariationPicker, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalBlockPatternSetup as BlockPatternSetup, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalBlockVariationPicker as BlockVariationPicker, // eslint-disable-line @wordpress/no-unsafe-wp-apis
__experimentalBlockPatternSetup as BlockPatternSetup, // eslint-disable-line @wordpress/no-unsafe-wp-apis
} from '@wordpress/block-editor';
import { createBlock, registerBlockVariation } from '@wordpress/blocks';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Replace eslint disable of `wpcalypso/no-unsafe-wp-apis` with `@wordpress/no-unsafe-wp-apis`. No change to functionality.


Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// eslint-disable-next-line wpcalypso/no-unsafe-wp-apis
import { __unstableInserterMenuExtension as InserterMenuExtension } from '@wordpress/block-editor';
import { __unstableInserterMenuExtension as InserterMenuExtension } from '@wordpress/block-editor'; // eslint-disable-line @wordpress/no-unsafe-wp-apis
import { useState } from '@wordpress/element';
import { registerPlugin } from '@wordpress/plugins';
import { debounce } from 'lodash';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { useBlockProps } from '@wordpress/block-editor';
import { Button, DateTimePicker, Dropdown, Placeholder } from '@wordpress/components';
import { useInstanceId } from '@wordpress/compose';
// eslint-disable-next-line wpcalypso/no-unsafe-wp-apis
import { dateI18n, __experimentalGetSettings } from '@wordpress/date';
import { dateI18n, __experimentalGetSettings } from '@wordpress/date'; // eslint-disable-line @wordpress/no-unsafe-wp-apis
import { __ } from '@wordpress/i18n';
import clsx from 'clsx';
import moment from 'moment';
Expand Down
5 changes: 5 additions & 0 deletions projects/packages/search/changelog/remove-calypso-eslint
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Replace eslint disable of `wpcalypso/no-unsafe-wp-apis` with `@wordpress/no-unsafe-wp-apis`. No change to functionality.


Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// NOTE: Expect this import to break when the exported value is renamed!
import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor'; // eslint-disable-line wpcalypso/no-unsafe-wp-apis
import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor'; // eslint-disable-line @wordpress/no-unsafe-wp-apis
import { useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';

Expand Down
5 changes: 5 additions & 0 deletions projects/packages/videopress/changelog/remove-calypso-eslint
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: changed
Comment: Replace eslint disable of `wpcalypso/no-unsafe-wp-apis` with `@wordpress/no-unsafe-wp-apis`. No change to functionality.


Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { PanelColorSettings } from '@wordpress/block-editor';
import {
PanelRow,
ToggleControl,
// eslint-disable-next-line wpcalypso/no-unsafe-wp-apis
__experimentalToolsPanelItem as ToolsPanelItem,
__experimentalToolsPanelItem as ToolsPanelItem, // eslint-disable-line @wordpress/no-unsafe-wp-apis
} from '@wordpress/components';
import { useDebounce } from '@wordpress/compose';
import { useCallback, useState } from '@wordpress/element';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
* External dependencies
*/
import {
// eslint-disable-next-line wpcalypso/no-unsafe-wp-apis
__experimentalNumberControl,
__experimentalNumberControl, // eslint-disable-line @wordpress/no-unsafe-wp-apis
TextControl,
RangeControl,
BaseControl,
Expand Down
5 changes: 5 additions & 0 deletions projects/plugins/jetpack/changelog/remove-calypso-eslint
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Replace eslint disable of `wpcalypso/no-unsafe-wp-apis` with `@wordpress/no-unsafe-wp-apis`. No change to functionality.


5 changes: 5 additions & 0 deletions projects/plugins/jetpack/changelog/remove-calypso-eslint#2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Remove `wpcalypso/jsx-classname-namespace` from eslintrc and `eslint-disable` comments, `eslint-plugin-wpcalypso` is being removed.


5 changes: 5 additions & 0 deletions projects/plugins/jetpack/changelog/remove-calypso-eslint#3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Change one `@return` comment to `@returns`, which we'll probably change back soon while doing the same across the monorepo but it's not worth the effort of avoiding now.


1 change: 0 additions & 1 deletion projects/plugins/jetpack/extensions/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module.exports = {
'react/react-in-jsx-scope': 0,
'space-unary-ops': 0,
'space-before-function-paren': 0,
'wpcalypso/jsx-classname-namespace': 0,

// eslint 6.x migration
'react-hooks/rules-of-hooks': 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
ContrastChecker,
PanelColorSettings,
__experimentalPanelColorGradientSettings as PanelColorGradientSettings, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalPanelColorGradientSettings as PanelColorGradientSettings, // eslint-disable-line @wordpress/no-unsafe-wp-apis
} from '@wordpress/block-editor';
import { __ } from '@wordpress/i18n';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { __experimentalUseGradient as useGradient } from '@wordpress/block-editor'; // eslint-disable-line wpcalypso/no-unsafe-wp-apis
import { __experimentalUseGradient as useGradient } from '@wordpress/block-editor'; // eslint-disable-line @wordpress/no-unsafe-wp-apis

export const IS_GRADIENT_AVAILABLE = !! useGradient;

Expand Down
2 changes: 1 addition & 1 deletion projects/plugins/jetpack/extensions/blocks/button/edit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
InspectorControls,
RichText,
__experimentalUseGradient as useGradient, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalUseGradient as useGradient, // eslint-disable-line @wordpress/no-unsafe-wp-apis
withColors,
} from '@wordpress/block-editor';
import { compose } from '@wordpress/compose';
Expand Down
2 changes: 1 addition & 1 deletion projects/plugins/jetpack/extensions/blocks/button/save.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
getColorClassName,
__experimentalGetGradientClass as getGradientClass, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalGetGradientClass as getGradientClass, // eslint-disable-line @wordpress/no-unsafe-wp-apis
RichText,
} from '@wordpress/block-editor';
import clsx from 'clsx';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, screen, within } from '@testing-library/react';
import { __experimentalUseGradient } from '@wordpress/block-editor'; // eslint-disable-line wpcalypso/no-unsafe-wp-apis
import { __experimentalUseGradient } from '@wordpress/block-editor'; // eslint-disable-line @wordpress/no-unsafe-wp-apis
import { ButtonEdit } from '../edit';

const defaultAttributes = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { __experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles } from '@wordpress/block-editor'; // eslint-disable-line wpcalypso/no-unsafe-wp-apis
import { __experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles } from '@wordpress/block-editor'; // eslint-disable-line @wordpress/no-unsafe-wp-apis
import { RawHTML } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import MarkdownIt from 'markdown-it';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
__experimentalBlockPatternSetup as BlockPatternSetup, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalBlockPatternSetup as BlockPatternSetup, // eslint-disable-line @wordpress/no-unsafe-wp-apis
} from '@wordpress/block-editor';
import { Button, Modal } from '@wordpress/components';
import { useState } from '@wordpress/element';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export default {
},

save: () => (
// eslint-disable-next-line wpcalypso/jsx-classname-namespace
<div className="wp-block-premium-content-logged-out-view">
<InnerBlocks.Content />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function LoginButtonEdit( props ) {

return (
<>
{ /* eslint-disable-next-line wpcalypso/jsx-classname-namespace */ }
<div { ...blockProps }>
<RichText
placeholder={ __( 'Add text…', 'jetpack' ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default function save( { attributes } ) {
} );

return (
// eslint-disable-next-line wpcalypso/jsx-classname-namespace
<div { ...blockProps }>
<RichText.Content
tagName="a"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InnerBlocks } from '@wordpress/block-editor';
import { TextControl, __experimentalUnitControl as UnitControl } from '@wordpress/components'; // eslint-disable-line wpcalypso/no-unsafe-wp-apis
import { TextControl, __experimentalUnitControl as UnitControl } from '@wordpress/components'; // eslint-disable-line @wordpress/no-unsafe-wp-apis
import './editor.scss';

const units = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import {
InspectorControls,
ContrastChecker,
withColors,
__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown, // eslint-disable-line @wordpress/no-unsafe-wp-apis
__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients, // eslint-disable-line @wordpress/no-unsafe-wp-apis
} from '@wordpress/block-editor';
import { PanelBody, MenuItemsChoice } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
ContrastChecker,
PanelColorSettings,
FontSizePicker,
__experimentalPanelColorGradientSettings as PanelColorGradientSettings, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalPanelColorGradientSettings as PanelColorGradientSettings, // eslint-disable-line @wordpress/no-unsafe-wp-apis
} from '@wordpress/block-editor';
import { ToggleControl, PanelBody, RangeControl, TextareaControl } from '@wordpress/components';
import { createInterpolateElement } from '@wordpress/element';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
getColorClassName,
__experimentalGetGradientClass as getGradientClass, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalGetGradientClass as getGradientClass, // eslint-disable-line @wordpress/no-unsafe-wp-apis
getFontSizeClass,
} from '@wordpress/block-editor';
import { RawHTML } from '@wordpress/element';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
getColorClassName,
__experimentalGetGradientClass as getGradientClass, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalGetGradientClass as getGradientClass, // eslint-disable-line @wordpress/no-unsafe-wp-apis
getFontSizeClass,
} from '@wordpress/block-editor';
import { RawHTML } from '@wordpress/element';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
getColorClassName,
__experimentalGetGradientClass as getGradientClass, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalGetGradientClass as getGradientClass, // eslint-disable-line @wordpress/no-unsafe-wp-apis
getFontSizeClass,
} from '@wordpress/block-editor';
import { RawHTML } from '@wordpress/element';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
getColorClassName,
__experimentalGetGradientClass as getGradientClass, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalGetGradientClass as getGradientClass, // eslint-disable-line @wordpress/no-unsafe-wp-apis
getFontSizeClass,
} from '@wordpress/block-editor';
import { RawHTML } from '@wordpress/element';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
withColors,
withFontSizes,
useBlockProps,
__experimentalUseGradient as useGradient, // eslint-disable-line wpcalypso/no-unsafe-wp-apis
__experimentalUseGradient as useGradient, // eslint-disable-line @wordpress/no-unsafe-wp-apis
} from '@wordpress/block-editor';
import { TextControl, Toolbar, withFallbackStyles } from '@wordpress/components';
import { compose, usePrevious } from '@wordpress/compose';
Expand Down
Loading
Loading