Skip to content

Commit

Permalink
ESLint Plugin: Add rule dependency-group (#13757)
Browse files Browse the repository at this point in the history
* Framework: Normalize dependencies docblocks

* ESLint Plugin: Add rule dependencies-docblocks

* ESLint Plugin: Add fixer implementation for dependency-group
  • Loading branch information
aduth authored and youknowriad committed Mar 6, 2019
1 parent f631af9 commit 987c450
Show file tree
Hide file tree
Showing 65 changed files with 453 additions and 57 deletions.
9 changes: 8 additions & 1 deletion packages/a11y/src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
/**
* WordPress dependencies
*/
import domReady from '@wordpress/dom-ready';

/**
* Internal dependencies
*/
import addContainer from './addContainer';
import clear from './clear';
import domReady from '@wordpress/dom-ready';
import filterMessage from './filterMessage';

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/a11y/src/test/addContainer.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
import addContainer from '../addContainer';

describe( 'addContainer', () => {
Expand Down
3 changes: 3 additions & 0 deletions packages/a11y/src/test/clear.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
import clear from '../clear';

describe( 'clear', () => {
Expand Down
3 changes: 3 additions & 0 deletions packages/a11y/src/test/filterMessage.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
import filterMessage from '../filterMessage';

describe( 'filterMessage', () => {
Expand Down
14 changes: 10 additions & 4 deletions packages/a11y/src/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
/**
* WordPress dependencies
*/
import domReady from '@wordpress/dom-ready';

/**
* Internal dependencies
*/
import { setup, speak } from '../';
import clear from '../clear';
import filterMessage from '../filterMessage';

jest.mock( '../clear', () => {
return jest.fn();
Expand All @@ -14,10 +24,6 @@ jest.mock( '../filterMessage', () => {
} );
} );

import clear from '../clear';
import domReady from '@wordpress/dom-ready';
import filterMessage from '../filterMessage';

describe( 'speak', () => {
let containerPolite = document.getElementById( 'a11y-speak-polite' );
let containerAssertive = document.getElementById( 'a11y-speak-assertive' );
Expand Down
3 changes: 3 additions & 0 deletions packages/blob/src/test/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
import {
isBlobURL,
} from '../';
Expand Down
10 changes: 7 additions & 3 deletions packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@ import {
} from 'lodash';

/**
* Internal dependencies
* WordPress dependencies
*/
import { MediaPlaceholder, RichText, BlockControls, InspectorControls, BottomSheet } from '@wordpress/editor';
import { Toolbar, ToolbarButton, Spinner, Dashicon } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import ImageSize from './image-size';
import { isURL } from '@wordpress/url';
import styles from './styles.scss';
import { compose } from '@wordpress/compose';
import { withSelect } from '@wordpress/data';

/**
* Internal dependencies
*/
import ImageSize from './image-size';
import styles from './styles.scss';

const MEDIA_UPLOAD_STATE_UPLOADING = 1;
const MEDIA_UPLOAD_STATE_SUCCEEDED = 2;
const MEDIA_UPLOAD_STATE_FAILED = 3;
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/image/image-size.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import { Component } from '@wordpress/element';

/**
* External dependencies
*/
* External dependencies
*/
import { View, Image } from 'react-native';

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/nextpage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { __ } from '@wordpress/i18n';
import { RawHTML } from '@wordpress/element';
import { createBlock } from '@wordpress/blocks';
import { G, Path, SVG } from '@wordpress/components';

/**
* Internal dependencies
*/
import edit from './edit';

export const name = 'core/nextpage';
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/paragraph/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { parse, createBlock } from '@wordpress/blocks';
import { RichText } from '@wordpress/editor';

/**
* Import style
* Internal dependencies
*/
import styles from './style.scss';

Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/preformatted/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* WordPress
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { createBlock, getPhrasingContentSchema } from '@wordpress/blocks';
Expand Down
3 changes: 3 additions & 0 deletions packages/block-library/src/pullquote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import {
} from '@wordpress/data';
import { Path, Polygon, SVG } from '@wordpress/components';

/**
* Internal dependencies
*/
import {
default as edit,
SOLID_COLOR_STYLE_NAME,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/spacer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import classnames from 'classnames';

/**
* WordPress
* WordPress dependencies
*/
import { Fragment } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/verse/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* WordPress
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { Fragment } from '@wordpress/element';
Expand Down
6 changes: 5 additions & 1 deletion packages/block-serialization-default-parser/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
import path from 'path';

/**
* Internal dependencies
* WordPress dependencies
*/
import { jsTester, phpTester } from '@wordpress/block-serialization-spec-parser';

/**
* Internal dependencies
*/
import { parse } from '../';

describe( 'block-serialization-default-parser-js', jsTester( parse ) );
Expand Down
2 changes: 1 addition & 1 deletion packages/blocks/src/api/raw-handling/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { mapValues, mergeWith, includes, noop } from 'lodash';
* WordPress dependencies
*/
import { unwrap, insertAfter, remove } from '@wordpress/dom';
import { hasBlockSupport } from '..';

/**
* Internal dependencies
*/
import { hasBlockSupport } from '..';
import { isPhrasingContent } from './phrasing-content';

/**
Expand Down
5 changes: 5 additions & 0 deletions packages/blocks/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
//
// Blocks are inferred from the HTML source of a post through a parsing mechanism
// and then stored as objects in state, from which it is then rendered for editing.

/**
* Internal dependencies
*/
import './store';

export * from './api';
export { withBlockContentContext } from './block-content-provider';
2 changes: 1 addition & 1 deletion packages/components/src/checkbox-control/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* External dependencies
* WordPress dependencies
*/
import { withInstanceId } from '@wordpress/compose';

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/color-palette/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { map } from 'lodash';
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import Dashicon from '../dashicon';

/**
* Internal dependencies
Expand All @@ -17,6 +16,7 @@ import Button from '../button';
import Dropdown from '../dropdown';
import Tooltip from '../tooltip';
import ColorPicker from '../color-picker';
import Dashicon from '../dashicon';

export default function ColorPalette( { colors, disableCustomColors = false, value, onChange, className } ) {
function applyOrUnset( color ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
/**
* External dependencies
*/
import { unescape } from 'lodash';

/**
* WordPress dependencies
*/
import { Component } from '@wordpress/element';
import { unescape } from 'lodash';

/**
* Internal dependencies
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/icon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* WordPress dependencies
*/
import { cloneElement, createElement, Component, isValidElement } from '@wordpress/element';

/**
* Internal dependencies
*/
import { Dashicon, SVG } from '../';

function Icon( { icon = null, size, className } ) {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/icon/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { shallow } from 'enzyme';
* WordPress dependencies
*/
import { Component } from '@wordpress/element';
import { Path, SVG } from '../../';

/**
* Internal dependencies
*/
import Icon from '../';
import { Path, SVG } from '../../';

describe( 'Icon', () => {
const className = 'example-class';
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/isolated-event-container/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* External dependencies
* WordPress dependencies
*/
import { Component } from '@wordpress/element';

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
* External dependencies
*/
import classnames from 'classnames';
import isShallowEqual from '@wordpress/is-shallow-equal';

/**
* WordPress dependencies
*/
import { Component, createRef } from '@wordpress/element';
import { focus } from '@wordpress/dom';
import { ESCAPE } from '@wordpress/keycodes';
import isShallowEqual from '@wordpress/is-shallow-equal';

/**
* Internal dependencies
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/primitives/svg/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* External dependencies
* WordPress dependencies
*/
import { createElement } from '@wordpress/element';

Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/server-side-render/test/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
import { rendererPath } from '../index';

describe( 'rendererPath', function() {
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/spinner/index.native.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* External dependencies
*/
import { View } from 'react-native';

export default function Spinner( props ) {
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/toolbar/toolbar-container.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
*/
import { View } from 'react-native';

/**
* Internal dependencies
*/
import styles from './style.scss';

const ToolbarContainer = ( props ) => (
Expand Down
2 changes: 1 addition & 1 deletion packages/compose/src/with-global-events/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import TestRenderer from 'react-test-renderer';

/**
* External dependencies
* WordPress dependencies
*/
import { Component } from '@wordpress/element';

Expand Down
3 changes: 3 additions & 0 deletions packages/data/src/default-registry.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
import { createRegistry } from './registry';

export default createRegistry();
3 changes: 3 additions & 0 deletions packages/dom-ready/src/test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* Internal dependencies
*/
import domReady from '../';

describe( 'domReady', () => {
Expand Down
3 changes: 3 additions & 0 deletions packages/e2e-test-utils/src/create-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import { join } from 'path';
import { URL } from 'url';

/**
* Internal dependencies
*/
import { WP_BASE_URL } from './shared/config';

/**
Expand Down
3 changes: 3 additions & 0 deletions packages/e2e-tests/specs/publish-button.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import {
arePrePublishChecksEnabled,
disablePrePublishChecks,
Expand Down
3 changes: 3 additions & 0 deletions packages/e2e-tests/specs/publish-panel.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* WordPress dependencies
*/
import {
arePrePublishChecksEnabled,
disablePrePublishChecks,
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/block-mover/drag-handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import classnames from 'classnames';

/**
* WordPress dependencies
* Internal dependencies
*/
import BlockDraggable from '../block-draggable';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import { compose } from '@wordpress/compose';
import { decodeEntities } from '@wordpress/html-entities';
import { withSelect, withDispatch } from '@wordpress/data';

/**
* Internal dependencies
*/
import styles from './style.scss';

export function DefaultBlockAppender( {
Expand Down
10 changes: 8 additions & 2 deletions packages/editor/src/components/media-placeholder/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
*/
import { View, Text, Button } from 'react-native';

import styles from './styles.scss';

/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import styles from './styles.scss';

function MediaPlaceholder( props ) {
return (
<View style={ styles.emptyStateContainer }>
Expand Down
Loading

0 comments on commit 987c450

Please sign in to comment.