Chore: ESlint import order (#44959)

* Add and configure eslint-plugin-import

* Fix the lint:ts npm command

* Autofix + prettier all the files

* Manually fix remaining files

* Move jquery code in jest-setup to external file to safely reorder imports

* Resolve issue caused by circular dependencies within Prometheus

* Update .betterer.results

* Fix missing // @ts-ignore

* ignore iconBundle.ts

* Fix missing // @ts-ignore
This commit is contained in:
Josh Hunt
2022-04-22 14:33:13 +01:00
committed by GitHub
parent 147a1600e7
commit 3c6e0e8ef8
3311 changed files with 14810 additions and 9526 deletions
@@ -1,14 +1,15 @@
import React, { useEffect } from 'react';
import { Permissions } from 'app/core/components/AccessControl';
import { connect, ConnectedProps } from 'react-redux';
import { Permissions } from 'app/core/components/AccessControl';
import Page from 'app/core/components/Page/Page';
import { getNavModel } from 'app/core/selectors/navModel';
import { contextSrv } from 'app/core/core';
import { getLoadingNav } from './state/navModel';
import { AccessControlAction, StoreState } from 'app/types';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import { AccessControlAction, StoreState } from 'app/types';
import { getFolderByUid } from './state/actions';
import { getLoadingNav } from './state/navModel';
interface RouteProps extends GrafanaRouteComponentProps<{ uid: string }> {}
@@ -1,11 +1,14 @@
import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useAsync } from 'react-use';
import Page from 'app/core/components/Page/Page';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import { StoreState } from 'app/types';
import React from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useAsync } from 'react-use';
import { AlertsFolderView } from '../alerting/unified/AlertsFolderView';
import { getFolderByUid } from './state/actions';
import { getLoadingNav } from './state/navModel';
@@ -2,15 +2,16 @@ import React, { useState } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { useAsync } from 'react-use';
import { GrafanaRouteComponentProps } from '../../core/navigation/types';
import { StoreState } from '../../types';
import { getNavModel } from '../../core/selectors/navModel';
import { getLoadingNav } from './state/navModel';
import { LibraryElementDTO } from '../library-panels/types';
import Page from '../../core/components/Page/Page';
import { GrafanaRouteComponentProps } from '../../core/navigation/types';
import { getNavModel } from '../../core/selectors/navModel';
import { StoreState } from '../../types';
import { LibraryPanelsSearch } from '../library-panels/components/LibraryPanelsSearch/LibraryPanelsSearch';
import { OpenLibraryPanelModal } from '../library-panels/components/OpenLibraryPanelModal/OpenLibraryPanelModal';
import { LibraryElementDTO } from '../library-panels/types';
import { getFolderByUid } from './state/actions';
import { getLoadingNav } from './state/navModel';
export interface OwnProps extends GrafanaRouteComponentProps<{ uid: string }> {}
@@ -1,11 +1,17 @@
import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import Page from 'app/core/components/Page/Page';
import { Tooltip, Icon, Button } from '@grafana/ui';
import { SlideDown } from 'app/core/components/Animations/SlideDown';
import Page from 'app/core/components/Page/Page';
import AddPermission from 'app/core/components/PermissionList/AddPermission';
import PermissionList from 'app/core/components/PermissionList/PermissionList';
import PermissionsInfo from 'app/core/components/PermissionList/PermissionsInfo';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import { StoreState } from 'app/types';
import { DashboardAcl, PermissionLevel, NewDashboardAclItem } from 'app/types/acl';
import {
getFolderByUid,
getFolderPermissions,
@@ -14,10 +20,6 @@ import {
addFolderPermission,
} from './state/actions';
import { getLoadingNav } from './state/navModel';
import PermissionList from 'app/core/components/PermissionList/PermissionList';
import AddPermission from 'app/core/components/PermissionList/AddPermission';
import PermissionsInfo from 'app/core/components/PermissionList/PermissionsInfo';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
export interface OwnProps extends GrafanaRouteComponentProps<{ uid: string }> {}
@@ -1,11 +1,13 @@
import React from 'react';
import { FolderSettingsPage, Props } from './FolderSettingsPage';
import { shallow } from 'enzyme';
import { NavModel } from '@grafana/data';
import React from 'react';
import { mockToolkitActionCreator } from 'test/core/redux/mocks';
import { setFolderTitle } from './state/reducers';
import { NavModel } from '@grafana/data';
import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps';
import { FolderSettingsPage, Props } from './FolderSettingsPage';
import { setFolderTitle } from './state/reducers';
const setup = (propOverrides?: object) => {
const props: Props = {
...getRouteComponentProps(),
@@ -1,16 +1,19 @@
import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { Button, LegacyForms } from '@grafana/ui';
const { Input } = LegacyForms;
import Page from 'app/core/components/Page/Page';
import appEvents from 'app/core/app_events';
import Page from 'app/core/components/Page/Page';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
import { getNavModel } from 'app/core/selectors/navModel';
import { StoreState } from 'app/types';
import { ShowConfirmModalEvent } from '../../types/events';
import { deleteFolder, getFolderByUid, saveFolder } from './state/actions';
import { getLoadingNav } from './state/navModel';
import { setFolderTitle } from './state/reducers';
import { ShowConfirmModalEvent } from '../../types/events';
import { GrafanaRouteComponentProps } from 'app/core/navigation/types';
export interface OwnProps extends GrafanaRouteComponentProps<{ uid: string }> {}
@@ -1,11 +1,13 @@
import React, { PureComponent } from 'react';
import { connect, ConnectedProps } from 'react-redux';
import { Button, Input, Form, Field } from '@grafana/ui';
import Page from 'app/core/components/Page/Page';
import { createNewFolder } from '../state/actions';
import { getNavModel } from 'app/core/selectors/navModel';
import { StoreState } from 'app/types';
import { validationSrv } from '../../manage-dashboards/services/ValidationSrv';
import { createNewFolder } from '../state/actions';
const mapStateToProps = (state: StoreState) => ({
navModel: getNavModel(state.navIndex, 'manage-dashboards'),
@@ -1,11 +1,13 @@
import { Observable, of, throwError } from 'rxjs';
import { thunkTester } from 'test/core/thunk/thunkTester';
import { checkFolderPermissions } from './actions';
import { setCanViewFolderPermissions } from './reducers';
import { backendSrv } from 'app/core/services/backend_srv';
import { FetchResponse } from '@grafana/runtime';
import { notifyApp } from 'app/core/actions';
import { createWarningNotification } from 'app/core/copy/appNotification';
import { FetchResponse } from '@grafana/runtime';
import { backendSrv } from 'app/core/services/backend_srv';
import { checkFolderPermissions } from './actions';
import { setCanViewFolderPermissions } from './reducers';
describe('folder actions', () => {
let fetchSpy: jest.SpyInstance<Observable<FetchResponse<unknown>>>;
+3 -1
View File
@@ -1,3 +1,5 @@
import { lastValueFrom } from 'rxjs';
import { locationUtil } from '@grafana/data';
import { getBackendSrv, locationService } from '@grafana/runtime';
import { notifyApp, updateNavIndex } from 'app/core/actions';
@@ -6,7 +8,7 @@ import { contextSrv } from 'app/core/core';
import { backendSrv } from 'app/core/services/backend_srv';
import { FolderState, ThunkResult } from 'app/types';
import { DashboardAcl, DashboardAclUpdateDTO, NewDashboardAclItem, PermissionLevel } from 'app/types/acl';
import { lastValueFrom } from 'rxjs';
import { buildNavModel } from './navModel';
import { loadFolder, loadFolderPermissions, setCanViewFolderPermissions } from './reducers';
@@ -1,6 +1,5 @@
import { NavModel, NavModelItem } from '@grafana/data';
import { contextSrv } from 'app/core/services/context_srv';
import { AccessControlAction, FolderDTO } from 'app/types';
export function buildNavModel(folder: FolderDTO): NavModelItem {
@@ -1,4 +1,7 @@
import { FolderDTO, FolderState, OrgRole, PermissionLevel } from 'app/types';
import { reducerTester } from '../../../../test/core/redux/reducerTester';
import {
folderReducer,
initialState,
@@ -7,7 +10,6 @@ import {
setCanViewFolderPermissions,
setFolderTitle,
} from './reducers';
import { reducerTester } from '../../../../test/core/redux/reducerTester';
function getTestFolder(): FolderDTO {
return {
@@ -1,7 +1,7 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { DashboardAclDTO, FolderDTO, FolderState } from 'app/types';
import { processAclItems } from 'app/core/utils/acl';
import { DashboardAclDTO, FolderDTO, FolderState } from 'app/types';
export const initialState: FolderState = {
id: 0,