Skip to content

Commit 852a80f

Browse files
authored
build: Organize imports in Property DDS (#20153)
Enable import organization for the PropertyDDS projects. New scripts were added and biome was added as a dependency. Manually fixed up a lint suppression in property-dds. Builds on top of #20117.
1 parent 8eb5443 commit 852a80f

File tree

117 files changed

+554
-495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+554
-495
lines changed

experimental/PropertyDDS/examples/property-inspector/package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@
1616
"build:compile": "fluid-build . --task compile",
1717
"build:webpack": "npm run webpack",
1818
"build:webpack:dev": "webpack --env.clean",
19+
"check:biome": "biome check .",
20+
"check:prettier": "prettier --check . --cache --ignore-path ../../../../.prettierignore",
1921
"clean": "rimraf --glob dist \"**/*.tsbuildinfo\" \"**/*.build.log\" nyc",
2022
"eslint": "eslint --format stylish src",
2123
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
22-
"format": "npm run prettier:fix",
23-
"lint": "npm run prettier && npm run eslint",
24-
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
24+
"format": "fluid-build --task format .",
25+
"format:biome": "biome check --apply .",
26+
"format:prettier": "prettier --write . --cache --ignore-path ../../../../.prettierignore",
27+
"lint": "fluid-build . --task lint",
28+
"lint:fix": "fluid-build . --task eslint:fix --task format",
2529
"prepack": "npm run webpack",
26-
"prettier": "prettier --check . --cache --ignore-path ../../../../.prettierignore",
27-
"prettier:fix": "prettier --write . --cache --ignore-path ../../../../.prettierignore",
2830
"start": "webpack serve --open",
2931
"start:server": "tinylicious",
3032
"start:test": "webpack serve --config webpack.test.cjs",
@@ -75,6 +77,7 @@
7577
"react-virtualized-auto-sizer": "^1.0.6"
7678
},
7779
"devDependencies": {
80+
"@biomejs/biome": "^1.6.1",
7881
"@fluidframework/build-common": "^2.0.3",
7982
"@fluidframework/build-tools": "^0.34.0",
8083
"@types/jest": "29.5.3",

experimental/PropertyDDS/examples/property-inspector/src/app.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
*/
55

66
import { StaticCodeLoader, TinyliciousModelLoader } from "@fluid-example/example-utils";
7-
import { PropertyFactory } from "@fluid-experimental/property-properties";
87
import { registerSchemas } from "@fluid-example/schemas";
8+
import { PropertyFactory } from "@fluid-experimental/property-properties";
99

10-
import { PropertyTreeContainerRuntimeFactory, IPropertyTreeAppModel } from "./containerCode";
10+
import { IPropertyTreeAppModel, PropertyTreeContainerRuntimeFactory } from "./containerCode";
1111
import { renderApp } from "./inspector";
1212

1313
/**

experimental/PropertyDDS/examples/property-inspector/src/containerCode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ModelContainerRuntimeFactory, getDataStoreEntryPoint } from "@fluid-exa
77
import { IContainer } from "@fluidframework/container-definitions";
88
import { IContainerRuntime } from "@fluidframework/container-runtime-definitions";
99

10-
import { PropertyTreeInstantiationFactory, IPropertyTree } from "./dataObject";
10+
import { IPropertyTree, PropertyTreeInstantiationFactory } from "./dataObject";
1111

1212
/**
1313
* The data model for our application.

experimental/PropertyDDS/examples/property-inspector/src/dataObject.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
*/
55

66
import { EventEmitter } from "@fluid-example/example-utils";
7+
import { PropertyTreeFactory, SharedPropertyTree } from "@fluid-experimental/property-dds";
78
import { BaseProperty } from "@fluid-experimental/property-properties";
89
import { DataObject, DataObjectFactory } from "@fluidframework/aqueduct";
910
import { IFluidHandle } from "@fluidframework/core-interfaces";
1011
import { IDirectory, IValueChanged } from "@fluidframework/map";
11-
import { SharedPropertyTree, PropertyTreeFactory } from "@fluid-experimental/property-dds";
1212
import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
1313

1414
export interface IPropertyTree extends EventEmitter {

experimental/PropertyDDS/examples/property-inspector/src/inspector.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import React from "react";
77
import ReactDOM from "react-dom";
88

9-
import _ from "lodash";
109
import {
1110
IDataCreationOptions,
1211
IInspectorRow,
@@ -17,9 +16,10 @@ import {
1716
fetchRegisteredTemplates,
1817
handlePropertyDataCreation,
1918
} from "@fluid-experimental/property-inspector-table";
19+
import _ from "lodash";
2020

21-
import { makeStyles } from "@material-ui/styles";
2221
import { MuiThemeProvider } from "@material-ui/core/styles";
22+
import { makeStyles } from "@material-ui/styles";
2323

2424
import { PropertyProxy } from "@fluid-experimental/property-proxy";
2525

experimental/PropertyDDS/examples/property-inspector/tests/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import { SessionStorageModelLoader, StaticCodeLoader } from "@fluid-example/example-utils";
77

8+
import { IPropertyTreeAppModel, PropertyTreeContainerRuntimeFactory } from "../src/containerCode";
89
import { renderApp } from "../src/inspector";
9-
import { PropertyTreeContainerRuntimeFactory, IPropertyTreeAppModel } from "../src/containerCode";
1010

1111
/**
1212
* This is a helper function for loading the page. It's required because getting the Fluid Container

experimental/PropertyDDS/examples/schemas/built/src/squares_demo/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* Licensed under the MIT License.
44
*/
55

6-
import board from "./squaresBoard-1.0.0";
76
import point2D from "./2DPoint-1.0.0";
87
import coloredSquare from "./coloredSquare-1.0.0";
98
import square from "./square-1.0.0";
9+
import board from "./squaresBoard-1.0.0";
1010
export const schemas = {
1111
board,
1212
point2D,

experimental/PropertyDDS/examples/schemas/package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,21 @@
1717
"scripts": {
1818
"build": "fluid-build . --task build",
1919
"build:compile": "fluid-build . --task compile",
20+
"check:biome": "biome check .",
21+
"check:prettier": "prettier --check . --cache --ignore-path ../../../../.prettierignore",
2022
"clean": "rimraf --glob dist \"**/*.tsbuildinfo\" \"**/*.build.log\"",
2123
"eslint": "eslint --format stylish src",
2224
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
23-
"format": "npm run prettier:fix",
24-
"lint": "npm run prettier && npm run eslint",
25-
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
26-
"prettier": "prettier --check . --cache --ignore-path ../../../../.prettierignore",
27-
"prettier:fix": "prettier --write . --cache --ignore-path ../../../../.prettierignore",
25+
"format": "fluid-build --task format .",
26+
"format:biome": "biome check --apply .",
27+
"format:prettier": "prettier --write . --cache --ignore-path ../../../../.prettierignore",
28+
"lint": "fluid-build . --task lint",
29+
"lint:fix": "fluid-build . --task eslint:fix --task format",
2830
"test": "echo \"Error: no test specified\" && exit 1",
2931
"tsc": "tsc"
3032
},
3133
"devDependencies": {
34+
"@biomejs/biome": "^1.6.1",
3235
"@fluidframework/build-common": "^2.0.3",
3336
"@fluidframework/build-tools": "^0.34.0",
3437
"eslint": "~8.55.0",

experimental/PropertyDDS/examples/schemas/src/squares_demo/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
* Licensed under the MIT License.
44
*/
55

6-
import board from "./squaresBoard-1.0.0";
76
import point2D from "./2DPoint-1.0.0";
87
import coloredSquare from "./coloredSquare-1.0.0";
98
import square from "./square-1.0.0";
9+
import board from "./squaresBoard-1.0.0";
1010

1111
/**
1212
* @internal

experimental/PropertyDDS/packages/property-binder/package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,20 @@
4040
"build:test": "npm run build:test:cjs",
4141
"build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.json",
4242
"check:are-the-types-wrong": "attw --pack . --entrypoints .",
43+
"check:biome": "biome check .",
44+
"check:prettier": "prettier --check . --cache --ignore-path ../../../../.prettierignore",
4345
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" nyc",
4446
"doc": "cross-var appfw-typedoc $npm_package_name",
4547
"eslint": "eslint --format stylish src",
4648
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
47-
"format": "npm run prettier:fix",
49+
"format": "fluid-build --task format .",
50+
"format:biome": "biome check --apply .",
51+
"format:prettier": "prettier --write . --cache --ignore-path ../../../../.prettierignore",
4852
"gen:tscdef": "tsc -p tsconfig.json --outDir dist -d",
49-
"lint": "npm run prettier && npm run eslint",
50-
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
53+
"lint": "fluid-build . --task lint",
54+
"lint:fix": "fluid-build . --task eslint:fix --task format",
5155
"precit": "bash -c \"npm run test -- --reporters dots; echo '----------Linting----------'; npm run lint; echo '----------Docs----------'; npm run doc\"",
5256
"prepublishOnly": "npm run test:dist",
53-
"prettier": "prettier --check . --cache --ignore-path ../../../../.prettierignore",
54-
"prettier:fix": "prettier --write . --cache --ignore-path ../../../../.prettierignore",
5557
"test": "npm run test:jest",
5658
"pretest:coverage": "rimraf --glob coverage/",
5759
"test:coverage": "c8 npm test",
@@ -93,6 +95,7 @@
9395
"@babel/plugin-proposal-decorators": "^7.20.4",
9496
"@babel/plugin-transform-runtime": "^7.2.0",
9597
"@babel/preset-env": "^7.2.0",
98+
"@biomejs/biome": "^1.6.1",
9699
"@fluidframework/build-common": "^2.0.3",
97100
"@fluidframework/build-tools": "^0.34.0",
98101
"@fluidframework/test-runtime-utils": "workspace:~",

experimental/PropertyDDS/packages/property-binder/src/data_binder/baseContext.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
* Licensed under the MIT License.
44
*/
55

6-
import { DataBinding } from "./dataBinding.js";
7-
import { BaseProperty } from "@fluid-experimental/property-properties";
86
import { SerializedChangeSet, Utils } from "@fluid-experimental/property-changeset";
7+
import { BaseProperty } from "@fluid-experimental/property-properties";
8+
import { DataBinding } from "./dataBinding.js";
99

1010
/**
1111
* Provides the abstract base class for all contexts passed to data binding callbacks.

experimental/PropertyDDS/packages/property-binder/src/data_binder/dataBinder.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@ import { DataBinderHandle } from "../internal/dataBinderHandle.js";
3434
import { PropertyElement } from "../internal/propertyElement.js";
3535
import { SemverMap, UpgradeType } from "../internal/semvermap.js";
3636
import { StatelessDataBindingWrapper } from "../internal/statelessDataBindingWrapper.js";
37+
import { IDefineDataBindingOptions } from "./IDefineDataBindingOptions.js";
3738
import { CallbackOptions, DataBinding } from "./dataBinding.js";
3839
import { DataBindingRegistry } from "./dataBindingRegistry.js";
39-
import { ArrayNode, concatTokenizedPath, DataBindingTree, NodeType } from "./dataBindingTree.js";
40-
import { IDefineDataBindingOptions } from "./IDefineDataBindingOptions.js";
40+
import { ArrayNode, DataBindingTree, NodeType, concatTokenizedPath } from "./dataBindingTree.js";
4141
import {
42+
RecursiveCallback,
4243
assertOperation,
4344
deferCallback,
4445
forEachProperty,
4546
invokeCallbacks,
4647
isPrimitiveCollection,
4748
makeCallbackOncePerChangeSet,
4849
minimalRootPaths,
49-
RecursiveCallback,
5050
recursivelyVisitHierarchy,
5151
visitTypeHierarchy,
5252
} from "./internalUtils.js";

experimental/PropertyDDS/packages/property-binder/src/data_binder/dataBinding.ts

+23-23
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
* Licensed under the MIT License.
44
*/
55

6+
import {
7+
ArrayChangeSetIterator,
8+
PathHelper,
9+
TypeIdHelper,
10+
Utils,
11+
} from "@fluid-experimental/property-changeset";
612
/**
713
* @fileoverview Defines the base DataBinding that all DataBindings should inherit from.
814
*/
@@ -11,40 +17,34 @@ import {
1117
PropertyFactory,
1218
ReferenceProperty,
1319
} from "@fluid-experimental/property-properties";
14-
import {
15-
PathHelper,
16-
TypeIdHelper,
17-
ArrayChangeSetIterator,
18-
Utils,
19-
} from "@fluid-experimental/property-changeset";
2020

2121
import _ from "lodash";
22-
import { ModificationContext } from "./modificationContext.js";
23-
import { RemovalContext } from "./removalContext.js";
2422
import {
25-
getOrInsertDefaultInNestedObjects,
2623
getInNestedObjects,
24+
getOrInsertDefaultInNestedObjects,
2725
} from "../external/utils/nestedObjectHelpers.js";
26+
import { DataBinder, DataBinderHandle, IRegisterOnPathOptions } from "../index.js";
27+
import { RESOLVE_ALWAYS, RESOLVE_NEVER, RESOLVE_NO_LEAFS } from "../internal/constants.js";
28+
import { PropertyElement } from "../internal/propertyElement.js";
29+
import { isCollection, isReferenceProperty } from "../internal/typeGuards.js";
30+
import { IRegisterOnPropertyOptions } from "./IRegisterOnPropertyOptions.js";
31+
import { concatTokenizedPath } from "./dataBindingTree.js";
2832
import {
33+
createHandle,
34+
createRegistrationFunction,
35+
deferCallback,
2936
escapeTokenizedPathForMap,
30-
unescapeTokenizedStringForMap,
37+
getOrCreateMemberOnPrototype,
3138
initializeReferencePropertyTableNode,
32-
invokeCallbacks,
33-
deferCallback,
34-
isDataBindingRegistered,
3539
installForEachPrototypeMember,
36-
getOrCreateMemberOnPrototype,
37-
createHandle,
38-
invokeWithProperty,
40+
invokeCallbacks,
3941
invokeWithCollectionProperty,
40-
createRegistrationFunction,
42+
invokeWithProperty,
43+
isDataBindingRegistered,
44+
unescapeTokenizedStringForMap,
4145
} from "./internalUtils.js";
42-
import { concatTokenizedPath } from "./dataBindingTree.js";
43-
import { RESOLVE_NEVER, RESOLVE_ALWAYS, RESOLVE_NO_LEAFS } from "../internal/constants.js";
44-
import { PropertyElement } from "../internal/propertyElement.js";
45-
import { DataBinder, DataBinderHandle, IRegisterOnPathOptions } from "../index.js";
46-
import { isCollection, isReferenceProperty } from "../internal/typeGuards.js";
47-
import { IRegisterOnPropertyOptions } from "./IRegisterOnPropertyOptions.js";
46+
import { ModificationContext } from "./modificationContext.js";
47+
import { RemovalContext } from "./removalContext.js";
4848

4949
/**
5050
* _globalVisitIndex is to avoid callbacks being called twice. This works around bugs in getChangesToTokenizedPaths

experimental/PropertyDDS/packages/property-binder/src/data_binder/dataBindingRegistry.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
* Licensed under the MIT License.
44
*/
55

6-
import { SemverMap, UpgradeType } from "../internal/semvermap.js";
7-
import { getLocalOrRemoteSchema } from "./internalUtils.js";
86
import { TypeIdHelper } from "@fluid-experimental/property-changeset";
9-
import { DataBindingDefinition } from "./dataBinder.js";
107
import { SharedPropertyTree } from "@fluid-experimental/property-dds";
8+
import { SemverMap, UpgradeType } from "../internal/semvermap.js";
9+
import { DataBindingDefinition } from "./dataBinder.js";
10+
import { getLocalOrRemoteSchema } from "./internalUtils.js";
1111

1212
/**
1313
* A DataBindingRegistry allows one to register and create representations. The type of the representation is

experimental/PropertyDDS/packages/property-binder/src/data_binder/dataBindingTree.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Licensed under the MIT License.
44
*/
55

6+
import { PathHelper } from "@fluid-experimental/property-changeset";
7+
import { PATH_TOKENS_TYPE, TOKEN_TYPES_TYPE } from "@fluid-experimental/property-properties";
68
/**
79
* @fileoverview Defines a data structure for storing an DataBinding tree that mirrors a property set hierarchy with
810
* DataBindings representing certain properties. Meant to handle the case where there are many properties but only some
@@ -11,8 +13,6 @@
1113
* TODO: this is getting a bit messy. Refactor to have a(n abstract) baseclass and proper derived classes
1214
*/
1315
import _ from "underscore";
14-
import { PathHelper } from "@fluid-experimental/property-changeset";
15-
import { PATH_TOKENS_TYPE, TOKEN_TYPES_TYPE } from "@fluid-experimental/property-properties";
1616
import { DataBinding } from "./dataBinding.js";
1717

1818
export type NodeType = DataBindingTree | ArrayNode | null | undefined;

experimental/PropertyDDS/packages/property-binder/src/data_binder/internalUtils.ts

+15-15
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,30 @@
33
* Licensed under the MIT License.
44
*/
55

6-
/**
7-
* @fileoverview Some internal utils functions
8-
*/
9-
import _ from "lodash";
6+
import {
7+
ArrayChangeSetIterator,
8+
PathHelper,
9+
SerializedChangeSet,
10+
TypeIdHelper,
11+
Utils,
12+
} from "@fluid-experimental/property-changeset";
1013
import {
1114
BaseProperty,
1215
ContainerProperty,
1316
PropertyFactory,
1417
PropertyTemplate,
1518
} from "@fluid-experimental/property-properties";
16-
import {
17-
PathHelper,
18-
TypeIdHelper,
19-
ArrayChangeSetIterator,
20-
Utils,
21-
SerializedChangeSet,
22-
} from "@fluid-experimental/property-changeset";
23-
import { ModificationContext } from "./modificationContext.js";
19+
/**
20+
* @fileoverview Some internal utils functions
21+
*/
22+
import _ from "lodash";
2423
import { getOrInsertDefaultInNestedObjects } from "../external/utils/nestedObjectHelpers.js";
25-
import { DataBinderHandle } from "../internal/dataBinderHandle.js";
26-
import { RESOLVE_NEVER, RESOLVE_ALWAYS } from "../internal/constants.js";
2724
import { DataBinding, PropertyElement } from "../index.js";
28-
import { DataBindingTree, NodeType } from "./dataBindingTree.js";
25+
import { RESOLVE_ALWAYS, RESOLVE_NEVER } from "../internal/constants.js";
26+
import { DataBinderHandle } from "../internal/dataBinderHandle.js";
2927
import { BaseContext } from "./baseContext.js";
28+
import { DataBindingTree, NodeType } from "./dataBindingTree.js";
29+
import { ModificationContext } from "./modificationContext.js";
3030

3131
export type RecursiveCallback = (
3232
in_propertyElement: PropertyElement,

experimental/PropertyDDS/packages/property-binder/src/data_binder/modificationContext.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
* @fileoverview Provides the contextual information for the onModify callbacks.
88
*/
99

10-
import { DataBinding } from "./dataBinding.js";
10+
import { SerializedChangeSet, Utils } from "@fluid-experimental/property-changeset";
1111
import { BaseProperty } from "@fluid-experimental/property-properties";
12-
import { BaseContext } from "./baseContext.js";
1312
import { PropertyElement } from "../internal/propertyElement.js";
14-
import { SerializedChangeSet, Utils } from "@fluid-experimental/property-changeset";
13+
import { BaseContext } from "./baseContext.js";
14+
import { DataBinding } from "./dataBinding.js";
1515

1616
/**
1717
* Provides the contextual information for the onModify callbacks.

experimental/PropertyDDS/packages/property-binder/src/data_binder/statelessDataBinding.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
* by the client, but is called back for onPreModify, onModify etc. for all instances of a type.
99
*/
1010

11-
import { DataBinding } from "./dataBinding.js";
1211
import { BaseProperty } from "@fluid-experimental/property-properties";
1312
import { IStatelessDataBindingOptions } from "./IStatelessDataBindingOptions.js";
13+
import { DataBinding } from "./dataBinding.js";
1414
import { ModificationContext } from "./modificationContext.js";
1515
import { RemovalContext } from "./removalContext.js";
1616

0 commit comments

Comments
 (0)