chore: lint
This commit is contained in:
parent
597de89826
commit
7d15057699
|
@ -30,6 +30,8 @@
|
|||
"ansi-html": "0.0.7",
|
||||
"classnames": "2.2.6",
|
||||
"contempo": "1.x",
|
||||
"debug": "^4.1.1",
|
||||
"deepmerge": "^4.2.2",
|
||||
"express": "^4.17.1",
|
||||
"express-session": "^1.17.1",
|
||||
"express-socket.io-session": "^1.3.5",
|
||||
|
@ -44,6 +46,7 @@
|
|||
"react-markdown": "^4.3.1",
|
||||
"react-redux": "^7.2.0",
|
||||
"react-tabs": "^3.1.1",
|
||||
"redux": "^4.0.5",
|
||||
"scwp": "1.x",
|
||||
"socket.io-redis": "^5.3.0",
|
||||
"source-map-support": "^0.5.11"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import './app.scss';
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
|
||||
import {all} from './resources.scwp';
|
||||
|
@ -10,11 +11,21 @@ const Resource = (props) => {
|
|||
const {
|
||||
uri,
|
||||
} = props;
|
||||
const resource = resources.find((resource) => uri.match(resource.matcher));
|
||||
const {Component} = resource
|
||||
? resource
|
||||
: {Component: () => <div className="unloadable">No loader for `<code>{uri}</code>`.</div>};
|
||||
const resource = resources.find((r) => uri.match(r.matcher));
|
||||
const {
|
||||
Component = () => (
|
||||
<div className="unloadable">
|
||||
No loader for `
|
||||
<code>{uri}</code>
|
||||
`.
|
||||
</div>
|
||||
),
|
||||
} = resource || {};
|
||||
return <div className="resource"><Component uri={uri} /></div>;
|
||||
};
|
||||
|
||||
Resource.propTypes = {
|
||||
uri: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default Resource;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {compose} from '@avocado/core';
|
||||
import {Entity} from '@avocado/entity';
|
||||
import contempo from 'contempo';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, {useEffect} from 'react';
|
||||
import {useDispatch, useSelector} from 'react-redux';
|
||||
|
||||
|
@ -35,4 +36,8 @@ const EntityComponent = (props) => {
|
|||
);
|
||||
};
|
||||
|
||||
EntityComponent.propTypes = {
|
||||
uri: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default decorate(EntityComponent);
|
||||
|
|
|
@ -4,5 +4,6 @@ export default {
|
|||
keys: ['entity', 'entities'],
|
||||
matcher: /\.entity\.json$/,
|
||||
Component: EntityComponent,
|
||||
// eslint-disable-next-line global-require
|
||||
state: require('./state'),
|
||||
};
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable no-param-reassign */
|
||||
import {normalize, schema} from 'normalizr';
|
||||
import {
|
||||
createAsyncThunk,
|
||||
|
@ -15,7 +16,7 @@ export const fetchEntity = createAsyncThunk(
|
|||
const json = await data.json();
|
||||
const {entities} = normalize(json, entitySchema);
|
||||
return entities;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const adapter = createEntityAdapter({
|
||||
|
@ -28,8 +29,8 @@ export const {
|
|||
selectIds: selectEntityIds,
|
||||
selectEntities: selectEntityEntities,
|
||||
selectAll: selectAllEntities,
|
||||
selectTotal: selectTotalEntities
|
||||
} = adapter.getSelectors((state) => state.entities)
|
||||
selectTotal: selectTotalEntities,
|
||||
} = adapter.getSelectors((state) => state.entities);
|
||||
|
||||
export const selectEntityUris = createSelector(
|
||||
(state) => state.entities,
|
||||
|
@ -41,13 +42,21 @@ export const selectEntityByUri = createSelector(
|
|||
selectEntityUris,
|
||||
(_, uri) => uri,
|
||||
({entities}, uris, uri) => entities[uris[uri]],
|
||||
)
|
||||
);
|
||||
|
||||
const slice = createSlice({
|
||||
name: 'entities',
|
||||
initialState: adapter.getInitialState({uris: {}}),
|
||||
reducers: {
|
||||
setTraitProperty: (state, {payload: {target, trait, type, key, value}}) => {
|
||||
setTraitProperty: (state, {
|
||||
payload: {
|
||||
target,
|
||||
trait,
|
||||
type,
|
||||
key,
|
||||
value,
|
||||
},
|
||||
}) => {
|
||||
const {traits} = state.entities[target];
|
||||
traits[trait] = traits[trait] || {};
|
||||
traits[trait][type] = traits[trait][type] || {};
|
||||
|
@ -59,6 +68,7 @@ const slice = createSlice({
|
|||
[fetchEntity.fulfilled]: (state, action) => {
|
||||
adapter.upsertMany(state, action.payload.entities);
|
||||
Object.entries(action.payload.entities)
|
||||
// eslint-disable-next-line no-return-assign
|
||||
.forEach(([id, entity]) => state.uris[entity.uri] = id);
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {mapObject} from '@avocado/core';
|
||||
import {lookupTrait} from '@avocado/entity';
|
||||
import {all as allTraitComponents} from '@avocado/entity/trait/trait-components.scwp';
|
||||
import PropTypes from 'prop-types';
|
||||
import React, {useMemo} from 'react';
|
||||
import {useDispatch} from 'react-redux';
|
||||
|
||||
|
@ -84,4 +85,11 @@ const TraitPane = (props) => {
|
|||
);
|
||||
};
|
||||
|
||||
TraitPane.propTypes = {
|
||||
context: PropTypes.shape({}).isRequired,
|
||||
target: PropTypes.string.isRequired,
|
||||
trait: PropTypes.shape({}).isRequired,
|
||||
type: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default TraitPane;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import PropTypes from 'prop-types';
|
||||
import React from 'react';
|
||||
|
||||
const TraitTab = (props) => {
|
||||
|
@ -11,4 +12,8 @@ const TraitTab = (props) => {
|
|||
);
|
||||
};
|
||||
|
||||
TraitTab.propTypes = {
|
||||
type: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
export default TraitTab;
|
||||
|
|
|
@ -76,6 +76,7 @@ const Traits = (props) => {
|
|||
|
||||
Traits.propTypes = {
|
||||
context: PropTypes.shape({}).isRequired,
|
||||
target: PropTypes.string.isRequired,
|
||||
traits: PropTypes.shape({}).isRequired,
|
||||
};
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import {all} from './resources.scwp';
|
|||
|
||||
const resources = Object.values(all()).map((M) => M.default);
|
||||
const reducerMap = resources.reduce(
|
||||
(r, {keys, state: {'default': reducer}}) => ({...r, [keys[1]]: reducer}),
|
||||
{}
|
||||
(r, {keys, state: {default: reducer}}) => ({...r, [keys[1]]: reducer}),
|
||||
{},
|
||||
);
|
||||
|
||||
export default function createStore(options = {}) {
|
||||
|
|
|
@ -3346,6 +3346,11 @@ deepmerge@^2.2.1:
|
|||
resolved "https://npm.i12e.cha0s.io/deepmerge/-/deepmerge-2.2.1.tgz#5d3ff22a01c00f645405a2fbc17d0778a1801170"
|
||||
integrity sha512-R9hc1Xa/NOBi9WRVUWg19rl1UB7Tt4kuPd+thNJgFZoxXsTz7ncaPaeIm+40oSGuP33DfMb4sZt1QIGiJzC4EA==
|
||||
|
||||
deepmerge@^4.2.2:
|
||||
version "4.2.2"
|
||||
resolved "https://npm.i12e.cha0s.io/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955"
|
||||
integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==
|
||||
|
||||
default-gateway@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://npm.i12e.cha0s.io/default-gateway/-/default-gateway-4.2.0.tgz#167104c7500c2115f6dd69b0a536bb8ed720552b"
|
||||
|
@ -7796,7 +7801,7 @@ redux-thunk@^2.3.0:
|
|||
resolved "https://npm.i12e.cha0s.io/redux-thunk/-/redux-thunk-2.3.0.tgz#51c2c19a185ed5187aaa9a2d08b666d0d6467622"
|
||||
integrity sha512-km6dclyFnmcvxhAcrQV2AkZmPQjzPDjgVlQtR0EQjxZPyJ0BnMf3in1ryuR8A2qU0HldVRfxYXbFSKlI3N7Slw==
|
||||
|
||||
redux@^4.0.0:
|
||||
redux@^4.0.0, redux@^4.0.5:
|
||||
version "4.0.5"
|
||||
resolved "https://npm.i12e.cha0s.io/redux/-/redux-4.0.5.tgz#4db5de5816e17891de8a80c424232d06f051d93f"
|
||||
integrity sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w==
|
||||
|
|
Loading…
Reference in New Issue
Block a user