Skip to content

Commit

Permalink
TASK: Fix linting issues
Browse files Browse the repository at this point in the history
Autofix via eslint
  • Loading branch information
Sebobo committed Nov 23, 2022
1 parent 0280ee3 commit 2597ffe
Show file tree
Hide file tree
Showing 30 changed files with 60 additions and 77 deletions.
1 change: 0 additions & 1 deletion packages/neos-ts-interfaces/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export interface DimensionCombination {
[propName: string]: DimensionValues;
}


export interface DimensionPresetCombination {
[propName: string]: DimensionPresetName;
}
Expand Down
3 changes: 1 addition & 2 deletions packages/neos-ui-backend-connector/src/Endpoints/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ export default (routes: Routes) => {
assetProxyTable.innerHTML = result;
const assetProxies = Array.from(assetProxyTable.querySelectorAll('.asset-proxy')) as HTMLElement[];


const mappedAssetProxies = assetProxies.map((assetProxy: HTMLElement) => {
const assetSourceIdentifier = getElementInnerText(assetProxy, '.asset-source-identifier');
const assetSourceLabel = getElementInnerText(assetProxy, '.asset-source-label');
Expand Down Expand Up @@ -650,7 +649,7 @@ export default (routes: Routes) => {
},
body: JSON.stringify({
contextNode: nodeContextPath,
text,
text
})
}))
.then(response => fetchWithErrorHandling.parseJson(response))
Expand Down
1 change: 0 additions & 1 deletion packages/neos-ui-backend-connector/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const initializeJsAPI = (parent: {[propName: string]: any}, {alias = 'neo
return parent[alias];
};


//
// Expose methods to access the initialized api
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ interface ViewConfiguration {
[prop: string]: any;
}
// We have to use a custom type guard in order to filter out null values, see https://codereview.stackexchange.com/a/184004
const isGroupedNodeTypeListItem = (str: GroupedNodeTypeListItem | null): str is GroupedNodeTypeListItem => !!str;
const isGroupedNodeTypeListItem = (str: GroupedNodeTypeListItem | null): str is GroupedNodeTypeListItem => Boolean(str);

export default class NodeTypesRegistry extends SynchronousRegistry<NodeType> {
private _constraints: ConstraintsMap = {};
Expand All @@ -56,7 +56,7 @@ export default class NodeTypesRegistry extends SynchronousRegistry<NodeType> {

private _inspectorViewConfigurationCache: {[propName: string]: any} = {};

public setConstraints (constraints: ConstraintsMap): void {
public setConstraints(constraints: ConstraintsMap): void {
this._constraints = constraints;
}

Expand All @@ -80,9 +80,8 @@ export default class NodeTypesRegistry extends SynchronousRegistry<NodeType> {
const role = this.getRole(roleName);
if (role) {
return this.isOfType(nodeTypeName, role);
} else {
return false;
}
return false;
}

public getAllowedChildNodeTypes(nodeTypeName: string): NodeTypeName[] {
Expand Down Expand Up @@ -201,9 +200,9 @@ export default class NodeTypesRegistry extends SynchronousRegistry<NodeType> {

return isMatch || isDefaultTab;
}).map(group => ({
...group,
items: positionalArraySorter([
...properties.filter(p => $get(['ui', 'inspector', 'group'], p) === group.id)
...group,
items: positionalArraySorter([
...properties.filter(p => $get(['ui', 'inspector', 'group'], p) === group.id)
.map(property => ({
type: 'editor',
id: $get(['id'], property),
Expand All @@ -216,7 +215,7 @@ export default class NodeTypesRegistry extends SynchronousRegistry<NodeType> {
helpThumbnail: $get(['ui', 'help', 'thumbnail'], property)
})
),
...views.filter(v => $get(['group'], v) === group.id)
...views.filter(v => $get(['group'], v) === group.id)
.map(property => ({
type: 'view',
id: $get(['id'], property),
Expand All @@ -227,8 +226,8 @@ export default class NodeTypesRegistry extends SynchronousRegistry<NodeType> {
helpMessage: $get(['helpMessage'], property)
})
)
], 'position', 'id')
})
], 'position', 'id')
})
)
}))
};
Expand Down
1 change: 0 additions & 1 deletion packages/neos-ui-decorators/src/neos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const NeosContext = React.createContext<NeosContextInterface | null>(null
// configuration
export default <OwnProps extends {}, InjectedProps extends {}> (mapRegistriesToProps: (globalRegistry: GlobalRegistry) => any) => (WrappedComponent: React.ComponentType<OwnProps & InjectedProps>) => {
const Decorator = class NeosDecorator extends React.PureComponent<OwnProps> {

public static readonly Original = WrappedComponent;

public static readonly contextType = NeosContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import {UnControlled as CodeMirror} from 'react-codemirror2';

// TODO: Find way to dynamically load any mode?
/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import XmlMode from 'codemirror/mode/xml/xml';
import HtmlMixedMode from 'codemirror/mode/htmlmixed/htmlmixed';
import JavascriptMode from 'codemirror/mode/javascript/javascript';
Expand All @@ -12,7 +12,7 @@ import MarkdownMode from 'codemirror/mode/markdown/markdown';
import YamlMode from 'codemirror/mode/yaml/yaml';
import Styles from './codemirror.vanilla-css';
import ThemeStyles from './codemirror-twilight.vanilla-css';
/* eslint-enable no-unused-vars */
/* eslint-enable @typescript-eslint/no-unused-vars */

export default class CodeMirrorWrap extends PureComponent {
static propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import AspectRatioDropDown from './AspectRatioDropDown/index';
import CropConfiguration, {CustomAspectRatioOption, LockedAspectRatioStrategy} from './model.js';
import style from './style.css';

/* eslint-disable no-unused-vars */
/* eslint-disable @typescript-eslint/no-unused-vars */
import ReactCropStyles from './react_crop.vanilla-css';
/* eslint-enable no-unused-vars */
import {$get} from 'plow-js';
Expand Down
2 changes: 1 addition & 1 deletion packages/neos-ui-extensibility/src/readFromConsumerApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export default function readFromConsumerApi(key: string): (...args: any[]) => an
return (window as any)['@Neos:HostPluginAPI'][`@${key}`](...args);
}

throw new Error("You are trying to read from a consumer api that hasn't been initialized yet!");
throw new Error('You are trying to read from a consumer api that hasn\'t been initialized yet!');
};
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default class AbstractRegistry {
public SERIAL_VERSION_UID = 'd8a5aa78-978e-11e6-ae22-56b6b6499611';

public description: string;

constructor(description: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const actions = {
/**
* Sets the currently allowed presets for dimension
*/
setAllowed: (dimensionName: string, allowedPresets: DimensionPresetName[]) => createAction(actionTypes.SET_ALLOWED, {dimensionName, allowedPresets})
setAllowed: (dimensionName: string, allowedPresets: DimensionPresetName[]) => createAction(actionTypes.SET_ALLOWED, {dimensionName, allowedPresets})
};

//
Expand All @@ -67,7 +67,7 @@ export const reducer = (state: State = defaultState, action: InitAction | Action
break;
}
case actionTypes.SELECT_PRESET: {
const targetPresets = action.payload.targetPresets;
const {targetPresets} = action.payload;
Object.keys(targetPresets).forEach(dimensionName => {
const presetName = targetPresets[dimensionName];
const dimensionValues = state.byName[dimensionName].presets[presetName].values;
Expand All @@ -78,7 +78,7 @@ export const reducer = (state: State = defaultState, action: InitAction | Action
break;
}
case actionTypes.SET_ACTIVE: {
const dimensionValues = action.payload.dimensionValues;
const {dimensionValues} = action.payload;
const previousActive = state.active;
if (previousActive !== null) {
Object.keys(previousActive).forEach(dimensionName => {
Expand Down Expand Up @@ -165,7 +165,7 @@ const activePresetsSelector = createSelector([
if (active !== null) {
return mapValues(active, (dimensionValues, name) => {
const dimensionConfiguration = byName[name];
const presets = dimensionConfiguration.presets;
const {presets} = dimensionConfiguration;
const activePreset = Object.keys(presets).find(dimensionName => isEqual(presets[dimensionName].values, dimensionValues));
const presetName = activePreset || dimensionConfiguration.defaultPreset;
const finalActivePreset = presets[presetName];
Expand Down
6 changes: 3 additions & 3 deletions packages/neos-ui-redux-store/src/CR/Nodes/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export const getNodeOrThrow = (nodeMap: NodeMap, contextPath: NodeContextPath) =
export const calculateNewFocusedNodes = (selectionMode: SelectionModeTypes, contextPath: NodeContextPath, focusedNodesContextPaths: NodeContextPath[], nodesByContextPath: NodeMap): NodeContextPath[] | null => {
if (selectionMode === SelectionModeTypes.SINGLE_SELECT) {
return [contextPath];
} else if (selectionMode === SelectionModeTypes.RANGE_SELECT) {
}
if (selectionMode === SelectionModeTypes.RANGE_SELECT) {
const lastSelectedNodeContextPath = focusedNodesContextPaths[focusedNodesContextPaths.length - 1];
const lastSelectedNode = nodesByContextPath[lastSelectedNodeContextPath];
if (lastSelectedNode && lastSelectedNode.parent) {
Expand All @@ -74,9 +75,8 @@ export const calculateNewFocusedNodes = (selectionMode: SelectionModeTypes, cont
if (startSelectionFlag) { // if matches for the second time it means that both start and end of selection were found
tempSelection.push(child.contextPath); // also push the last node
return true;
} else {
startSelectionFlag = true;
}
startSelectionFlag = true;
}
if (startSelectionFlag) {
tempSelection.push(child.contextPath);
Expand Down
6 changes: 3 additions & 3 deletions packages/neos-ui-redux-store/src/CR/Nodes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ export const reducer = (state: State = defaultState, action: InitAction | Action
// Update the context path for stored descendant of the moved node including the node itself
Object.keys(draft.byContextPath).forEach(contextPath => {
// Skip nodes that don't match the old path exactly or a descendant path
if (!contextPath.startsWith(oldPath + '/')
&& contextPath.split('@')[0] !== oldPath) {
if (!contextPath.startsWith(oldPath + '/') &&
contextPath.split('@')[0] !== oldPath) {
return;
}

Expand All @@ -518,7 +518,7 @@ export const reducer = (state: State = defaultState, action: InitAction | Action
child.contextPath = child.contextPath.replace(oldPath, newPath);
});

delete Object.assign(draft.byContextPath, {[updatedContextPath]: node })[contextPath];
delete Object.assign(draft.byContextPath, {[updatedContextPath]: node})[contextPath];
});
break;
}
Expand Down
7 changes: 3 additions & 4 deletions packages/neos-ui-redux-store/src/CR/Nodes/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export const focusedNodePathsSelector = (state: GlobalState) => $get(['cr', 'nod
// This is internal, as in most cases you want `focusedNodePathSelector`, which is able to fallback to documentNode, when no node is focused
export const _focusedNodeContextPathSelector = createSelector(
[
focusedNodePathsSelector,
focusedNodePathsSelector
],
(focusedNodePaths) => {
focusedNodePaths => {
return focusedNodePaths && focusedNodePaths[0] ? focusedNodePaths[0] : null;
}
);
Expand Down Expand Up @@ -289,7 +289,6 @@ export const makeGetAllowedChildNodeTypesSelector = (nodeTypesRegistry: NodeType
export const makeGetAllowedSiblingNodeTypesSelector = (nodeTypesRegistry: NodeTypesRegistry) =>
makeGetAllowedChildNodeTypesSelector(nodeTypesRegistry, (nodeContextPath, state) => getPathInNode(state, nodeContextPath, 'parent'));


export const makeIsAllowedToAddChildOrSiblingNodes = (nodeTypesRegistry: NodeTypesRegistry) => createSelector(
[
makeGetAllowedChildNodeTypesSelector(nodeTypesRegistry),
Expand Down Expand Up @@ -408,7 +407,7 @@ export const focusedNodeParentLineSelector = createSelector(
let currentNode = focusedNode;

while (currentNode) {
const parent = currentNode.parent;
const {parent} = currentNode;
if (parent) {
currentNode = nodesByContextPath[parent] || null;
if (currentNode) {
Expand Down
2 changes: 1 addition & 1 deletion packages/neos-ui-redux-store/src/CR/Workspaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const abortDiscard = () => createAction(actionTypes.DISCARD_ABORTED);
/**
* Confirm the ongoing discard
*/
const confirmDiscard = () => createAction(actionTypes.DISCARD_CONFIRMED);
const confirmDiscard = () => createAction(actionTypes.DISCARD_CONFIRMED);

/**
* Change base workspace
Expand Down
2 changes: 0 additions & 2 deletions packages/neos-ui-redux-store/src/CR/Workspaces/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {documentNodeContextPathSelector} from '../Nodes/selectors';
import {GlobalState} from '../../System';
import {NodeContextPath} from '@neos-project/neos-ts-interfaces';



export const personalWorkspaceNameSelector = (state: GlobalState) => $get(['cr', 'workspaces', 'personalWorkspace', 'name'], state);

export const baseWorkspaceSelector = (state: GlobalState) => $get(['cr', 'workspaces', 'personalWorkspace', 'baseWorkspace'], state);
Expand Down
1 change: 0 additions & 1 deletion packages/neos-ui-redux-store/src/CR/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {combineReducers} from '../combineReducers';


import * as ContentDimensions from './ContentDimensions';
import * as Nodes from './Nodes';
import * as Workspaces from './Workspaces';
Expand Down
1 change: 0 additions & 1 deletion packages/neos-ui-redux-store/src/ServerFeedback/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {action as createAction, ActionType} from 'typesafe-actions';

// import {handleActions} from '@neos-project/utils-redux';


//
// Export the action types
//
Expand Down
2 changes: 1 addition & 1 deletion packages/neos-ui-redux-store/src/UI/AddNodeModal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export enum actionTypes {
* @param {Object} fusionPath (optional) fusion path of the rendered node relative to which the new node ought to be
* positioned.
*/
const open = (contextPath: NodeContextPath, fusionPath: FusionPath = '') => createAction(actionTypes.OPEN, {contextPath, fusionPath});
const open = (contextPath: NodeContextPath, fusionPath: FusionPath = '') => createAction(actionTypes.OPEN, {contextPath, fusionPath});

/**
* Closes the add node modal.
Expand Down
4 changes: 2 additions & 2 deletions packages/neos-ui-redux-store/src/UI/ContentCanvas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export enum actionTypes {
TOGGLE_LINK_EDITOR = '@neos/neos-ui/UI/ContentCanvas/TOGGLE_LINK_EDITOR'
}

const setPreviewUrl = (previewUrl: string) => createAction(actionTypes.SET_PREVIEW_URL, previewUrl);
const setSrc = (src: string, metaKeyPressed: boolean = false) => createAction(actionTypes.SET_SRC, {src, metaKeyPressed});
const setPreviewUrl = (previewUrl: string) => createAction(actionTypes.SET_PREVIEW_URL, previewUrl);
const setSrc = (src: string, metaKeyPressed: boolean = false) => createAction(actionTypes.SET_SRC, {src, metaKeyPressed});
const setFormattingUnderCursor = (formatting: Formatting) => createAction(actionTypes.FORMATTING_UNDER_CURSOR, formatting);
const setCurrentlyEditedPropertyName = (propertyName: string) => createAction(actionTypes.SET_CURRENTLY_EDITED_PROPERTY_NAME, propertyName);
const startLoading = () => createAction(actionTypes.START_LOADING);
Expand Down
6 changes: 3 additions & 3 deletions packages/neos-ui-redux-store/src/UI/ContentTree/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const toggle = (contextPath: NodeContextPath) => createAction(actionTypes.TOGGLE
const startLoading = () => createAction(actionTypes.START_LOADING);
const stopLoading = () => createAction(actionTypes.STOP_LOADING);
const reloadTree = () => createAction(actionTypes.RELOAD_TREE);
const requestChildren = (contextPath: NodeContextPath, {unCollapse = true, activate = false} = {}) => createAction(actionTypes.REQUEST_CHILDREN, {contextPath, opts: {unCollapse, activate}});
const requestChildren = (contextPath: NodeContextPath, {unCollapse = true, activate = false} = {}) => createAction(actionTypes.REQUEST_CHILDREN, {contextPath, opts: {unCollapse, activate}});
const setAsLoading = (contextPath: NodeContextPath) => createAction(actionTypes.SET_AS_LOADING, {contextPath});
const setAsLoaded = (contextPath: NodeContextPath) => createAction(actionTypes.SET_AS_LOADED, {contextPath});

Expand Down Expand Up @@ -79,13 +79,13 @@ export const reducer = (state: State = defaultState, action: InitAction | Action
break;
}
case actionTypes.SET_AS_LOADING: {
const contextPath = action.payload.contextPath;
const {contextPath} = action.payload;
draft.errors = draft.errors.filter(i => i !== contextPath);
draft.loading.push(contextPath);
break;
}
case actionTypes.SET_AS_LOADED: {
const contextPath = action.payload.contextPath;
const {contextPath} = action.payload;
draft.loading = draft.loading.filter(i => i !== contextPath);
break;
}
Expand Down
1 change: 0 additions & 1 deletion packages/neos-ui-redux-store/src/UI/Inspector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const defaultState: State = {
valuesByNodePath: {}
};


//
// Export the action types
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const defaultState: State = {
isOpen: false
};


//
// Export the action types
//
Expand Down
4 changes: 1 addition & 3 deletions packages/neos-ui-redux-store/src/UI/LeftSideBar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface State extends Readonly<{
contentTree: {
isHidden: boolean;
},
searchBar: {
searchBar: {
isVisible: boolean;
};
}> {}
Expand All @@ -24,8 +24,6 @@ export const defaultState: State = {
}
};



//
// Export the action types
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ export const reducer = (state: State = defaultState, action: InitAction | Action

export const selectors = {
isOpen: (state: GlobalState) => $get(['ui', 'nodeVariantCreationDialog', 'isOpen'], state),
numberOfParentNodesToBeCreated: (state: GlobalState) => $get(['ui', 'nodeVariantCreationDialog', 'numberOfParentNodesToBeCreated'], state),
numberOfParentNodesToBeCreated: (state: GlobalState) => $get(['ui', 'nodeVariantCreationDialog', 'numberOfParentNodesToBeCreated'], state)
};
Loading

0 comments on commit 2597ffe

Please sign in to comment.