Merge branch 'develop' into feature-multidomain

This commit is contained in:
Chris Breiding
2022-01-19 14:29:35 -05:00
21 changed files with 201 additions and 200 deletions

View File

@@ -25,8 +25,8 @@ export function setConfig (c: CypressAngularConfig): void {
function init<T> (
component:
| Type<T>
| (Partial<TestModuleMetadata> & Partial<CypressAngularConfig>),
| Type<T>
| (Partial<TestModuleMetadata> & Partial<CypressAngularConfig>),
options?: Partial<TestModuleMetadata> & Partial<CypressAngularConfig>,
): void {
Cypress.log({ displayName: 'Unit Test', message: ['Init Environment'] })
@@ -111,8 +111,8 @@ function init<T> (
export function initEnv<T> (
component:
| Type<T>
| (Partial<TestModuleMetadata> & Partial<CypressAngularConfig>),
| Type<T>
| (Partial<TestModuleMetadata> & Partial<CypressAngularConfig>),
options?: Partial<TestModuleMetadata> & Partial<CypressAngularConfig>,
): void {
init(component, options)
@@ -143,8 +143,8 @@ export function mount<T> (
export function initEnvHtml<T> (
component:
| Type<T>
| (Partial<TestModuleMetadata> & Partial<CypressAngularConfig>),
| Type<T>
| (Partial<TestModuleMetadata> & Partial<CypressAngularConfig>),
options?: Partial<TestModuleMetadata> & Partial<CypressAngularConfig>,
): void {
init(component, options)

View File

@@ -13,15 +13,15 @@ type PackageJsonLike = {
type FindPackageJsonResult =
| {
packageData: PackageJsonLike
filename: string
done: false
}
packageData: PackageJsonLike
filename: string
done: false
}
| {
packageData: undefined
filename: undefined
done: true
}
packageData: undefined
filename: undefined
done: true
}
/**
* Return the parsed package.json that we find in a parent folder.

View File

@@ -14,7 +14,7 @@ import { catchError, concatMap, first, map, switchMap, tap } from 'rxjs/operator
import { CypressBuilderOptions } from './cypressBuilderOptions'
type CypressOptions = Partial<CypressCommandLine.CypressRunOptions> &
Partial<CypressCommandLine.CypressOpenOptions>;
Partial<CypressCommandLine.CypressOpenOptions>;
function runCypress (
options: CypressBuilderOptions,

View File

@@ -1,10 +1,10 @@
export interface Schema {
// The name of the spec.
name: string
// The name of the spec.
name: string
// The path to create the spec.
path?: string
// The path to create the spec.
path?: string
// The name of the project.
project?: string
// The name of the project.
project?: string
}

View File

@@ -13,18 +13,18 @@ import { JSONFile } from './jsonFile'
const PKG_JSON_PATH = '/package.json'
export enum NodeDependencyType {
Default = 'dependencies',
Dev = 'devDependencies',
Peer = 'peerDependencies',
Optional = 'optionalDependencies',
}
Default = 'dependencies',
Dev = 'devDependencies',
Peer = 'peerDependencies',
Optional = 'optionalDependencies',
}
export interface NodeDependency {
type: NodeDependencyType
name: string
version: string
overwrite?: boolean
}
type: NodeDependencyType
name: string
version: string
overwrite?: boolean
}
const ALL_DEPENDENCY_TYPE = [
NodeDependencyType.Default,

View File

@@ -25,84 +25,84 @@ export type JSONPath = (string | number)[];
/** @internal */
export class JSONFile {
content: string;
content: string;
constructor (private readonly host: Tree, private readonly path: string) {
const buffer = this.host.read(this.path)
constructor (private readonly host: Tree, private readonly path: string) {
const buffer = this.host.read(this.path)
if (buffer) {
this.content = buffer.toString()
} else {
throw new Error(`Could not read '${path}'.`)
}
}
if (buffer) {
this.content = buffer.toString()
} else {
throw new Error(`Could not read '${path}'.`)
}
}
private _jsonAst: Node | undefined;
private get JsonAst (): Node | undefined {
if (this._jsonAst) {
return this._jsonAst
}
private _jsonAst: Node | undefined;
private get JsonAst (): Node | undefined {
if (this._jsonAst) {
return this._jsonAst
}
const errors: ParseError[] = []
const errors: ParseError[] = []
this._jsonAst = parseTree(this.content, errors, { allowTrailingComma: true })
if (errors.length) {
const { error, offset } = errors[0]
this._jsonAst = parseTree(this.content, errors, { allowTrailingComma: true })
if (errors.length) {
const { error, offset } = errors[0]
throw new Error(
throw new Error(
`Failed to parse "${this.path}" as JSON AST Object. ${printParseErrorCode(
error,
)} at location: ${offset}.`,
)
}
)
}
return this._jsonAst
}
return this._jsonAst
}
get (jsonPath: JSONPath): unknown {
const jsonAstNode = this.JsonAst
get (jsonPath: JSONPath): unknown {
const jsonAstNode = this.JsonAst
if (!jsonAstNode) {
return undefined
}
if (!jsonAstNode) {
return undefined
}
if (jsonPath.length === 0) {
return getNodeValue(jsonAstNode)
}
if (jsonPath.length === 0) {
return getNodeValue(jsonAstNode)
}
const node = findNodeAtLocation(jsonAstNode, jsonPath)
const node = findNodeAtLocation(jsonAstNode, jsonPath)
return node === undefined ? undefined : getNodeValue(node)
}
return node === undefined ? undefined : getNodeValue(node)
}
modify (
jsonPath: JSONPath,
value: JsonValue | undefined,
): void {
let updatedValue = value
modify (
jsonPath: JSONPath,
value: JsonValue | undefined,
): void {
let updatedValue = value
if (jsonPath.includes('scripts')) {
const currentValue = this.get(jsonPath) as object
const newValue = value as object
if (jsonPath.includes('scripts')) {
const currentValue = this.get(jsonPath) as object
const newValue = value as object
updatedValue = { ...currentValue, ...newValue }
}
updatedValue = { ...currentValue, ...newValue }
}
const edits = modify(this.content, jsonPath, updatedValue, {
formattingOptions: {
insertSpaces: true,
tabSize: 2,
},
})
const edits = modify(this.content, jsonPath, updatedValue, {
formattingOptions: {
insertSpaces: true,
tabSize: 2,
},
})
this.content = applyEdits(this.content, edits)
this.host.overwrite(this.path, this.content)
this._jsonAst = undefined
}
this.content = applyEdits(this.content, edits)
this.host.overwrite(this.path, this.content)
this._jsonAst = undefined
}
remove (jsonPath: JSONPath): void {
if (this.get(jsonPath) !== undefined) {
this.modify(jsonPath, undefined)
}
}
remove (jsonPath: JSONPath): void {
if (this.get(jsonPath) !== undefined) {
this.modify(jsonPath, undefined)
}
}
}

View File

@@ -13,11 +13,11 @@ export interface SearchInputProps extends CoreComponent {
/**
* Defaults to 'm'
*/
size?: TextSize
size?: TextSize
onInput: (input: string) => void
onEnter?: (input: string) => void
onVerticalArrowKey?: (key: 'up' | 'down') => void
onInput: (input: string) => void
onEnter?: (input: string) => void
onVerticalArrowKey?: (key: 'up' | 'down') => void
['aria-label']: string
}

View File

@@ -30,20 +30,20 @@ const VirtualizedTreeContents = <
TLeaf extends LeafTreeBase,
TParent extends ParentTreeBase<TLeaf>
>({
innerRef,
treeRef,
tree,
defaultItemSize,
overscanCount = 20,
indentSize,
showRoot,
shouldMeasure,
onNodePress: externalOnNodePress,
onNodeKeyDown,
onRenderLeaf,
onRenderParent,
...props
}: VirtualizedTreeProps<TLeaf, TParent>) => {
innerRef,
treeRef,
tree,
defaultItemSize,
overscanCount = 20,
indentSize,
showRoot,
shouldMeasure,
onNodePress: externalOnNodePress,
onNodeKeyDown,
onRenderLeaf,
onRenderParent,
...props
}: VirtualizedTreeProps<TLeaf, TParent>) => {
type TNodeData = TreeNodeData<TLeaf, TParent>
const wrapperRef = useRef<HTMLDivElement | null>(null)
@@ -320,7 +320,7 @@ export const VirtualizedTree = <
TLeaf extends LeafTreeBase,
TParent extends ParentTreeBase<TLeaf>
>(props: VirtualizedTreeProps<TLeaf, TParent>) => (
<FocusStateContext>
<VirtualizedTreeContents {...props} />
</FocusStateContext>
)
<FocusStateContext>
<VirtualizedTreeContents {...props} />
</FocusStateContext>
)

View File

@@ -13,19 +13,19 @@ export const TreeChild = <
TLeaf extends LeafTreeBase,
TParent extends ParentTreeBase<TLeaf>
>({
data,
isOpen,
style,
height,
indentSize,
showRoot,
shouldMeasure,
onNodePress,
setOpen,
resize,
onRenderLeaf,
onRenderParent,
}: InternalChildProps<TLeaf, TParent>) => {
data,
isOpen,
style,
height,
indentSize,
showRoot,
shouldMeasure,
onNodePress,
setOpen,
resize,
onRenderLeaf,
onRenderParent,
}: InternalChildProps<TLeaf, TParent>) => {
const globalFocusId = useFocusState()
const id = data.node.id
@@ -67,26 +67,26 @@ const OnRenderChild = <
TLeaf extends LeafTreeBase,
TParent extends ParentTreeBase<TLeaf>
>({
data: { node, nestingLevel },
isOpen,
setOpen,
remeasure,
onRenderLeaf,
onRenderParent,
}: InternalOnRenderChildProps<TLeaf, TParent>) =>
isParent(node)
? onRenderParent({
parent: node,
depth: nestingLevel,
isOpen,
setOpen,
remeasure,
})
: onRenderLeaf({
leaf: node,
depth: nestingLevel,
remeasure,
})
data: { node, nestingLevel },
isOpen,
setOpen,
remeasure,
onRenderLeaf,
onRenderParent,
}: InternalOnRenderChildProps<TLeaf, TParent>) =>
isParent(node)
? onRenderParent({
parent: node,
depth: nestingLevel,
isOpen,
setOpen,
remeasure,
})
: onRenderLeaf({
leaf: node,
depth: nestingLevel,
remeasure,
})
// Memo `onRender` callback results to double the speed of height calculation
const MemoedOnRenderChild = memo(OnRenderChild) as typeof OnRenderChild

View File

@@ -150,8 +150,8 @@ export const isParent = <
TLeaf extends LeafTreeBase,
TParent extends ParentTreeBase<TLeaf>
>(
input: TLeaf | TParent,
): input is TParent => {
input: TLeaf | TParent,
): input is TParent => {
return 'children' in input
}

View File

@@ -89,7 +89,7 @@ export type BasicInputProps = SizingProps & Omit<InputHTMLAttributes<HTMLInputEl
/**
* If true, render as a textarea (multiline) instead of an input. Defaults to false
*/
textArea?: boolean
textArea?: boolean
}
/**

View File

@@ -22,19 +22,19 @@ export default createStorybookConfig({
})
export const Elevation = createStory<{
elevation: SurfaceElevation
}>(({ elevation }) => (
<div>
elevation: SurfaceElevation
}>(({ elevation }) => (
<div>
<ElevationComponent elevation={elevation}>
{lorem}
</ElevationComponent>
<br />
<StoryHighlightWrapper>
<ElevationComponent elevation={elevation}>
{lorem}
</ElevationComponent>
<br />
<StoryHighlightWrapper>
<ElevationComponent elevation={elevation}>
{lorem}
</ElevationComponent>
</StoryHighlightWrapper>
</div>
), {
elevation: 'bordered',
})
</StoryHighlightWrapper>
</div>
), {
elevation: 'bordered',
})

View File

@@ -22,18 +22,18 @@ export default createStorybookConfig({
})
export const PaddedBox = createStory<{
padding: Spacing
}>(({ padding }) => (
<div>
<StoryHighlightWrapper>
<PaddedComponent padding={padding}>
{lorem}
</PaddedComponent>
</StoryHighlightWrapper>
</div>
), {
padding: 'm',
})
padding: Spacing
}>(({ padding }) => (
<div>
<StoryHighlightWrapper>
<PaddedComponent padding={padding}>
{lorem}
</PaddedComponent>
</StoryHighlightWrapper>
</div>
), {
padding: 'm',
})
// Required to prevent Storybook from separating into two words and creating unnecessary nesting
PaddedBox.storyName = 'PaddedBox'

View File

@@ -269,6 +269,7 @@ module.exports = {
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'indent': 'off',
'@typescript-eslint/no-unused-vars': [
'error',
{
@@ -290,6 +291,15 @@ module.exports = {
},
},
],
'@typescript-eslint/indent': [
'error',
2,
{
'ignoredNodes': ['TemplateLiteral', 'TSTypeParameterInstantiation'],
'SwitchCase': 1,
'MemberExpression': 0,
},
],
},
},
],

View File

@@ -91,9 +91,9 @@ const _mount = (type: 'mount' | 'rerender', jsx: React.ReactNode, options: Mount
// since we always surround the component with a fragment
// let's get back the original component
const userComponent = (reactComponent.props as {
key: string
children: React.ReactNode
}).children
key: string
children: React.ReactNode
}).children
reactDomToUse.render(reactComponent, el)

View File

@@ -244,6 +244,7 @@
"**/pretty-format": "26.4.0",
"**/socket.io-parser": "4.0.4",
"**/ua-parser-js": "0.7.24",
"@typescript-eslint/eslint-plugin": "4.18.0",
"vue-template-compiler": "2.6.12"
}
}

View File

@@ -312,9 +312,9 @@ const shouldIgnoreEvent = <
T extends KeyEventType,
K extends { [key in T]?: boolean }
>(
eventName: T,
options: K,
) => {
eventName: T,
options: K,
) => {
return options[eventName] === false
}

View File

@@ -6,8 +6,8 @@ const HISTORY_NAV_ATTRS = 'go back forward'.split(' ')
type BoundEventHandler<K extends keyof WindowEventMap> =
K extends 'click' ? (this: Window, ev: GuardedAnchorEvent) => any
: K extends 'submit' ? (this: Window, ev: GuardedEvent) => any
: (this: Window, ev: WindowEventMap[K]) => any
: K extends 'submit' ? (this: Window, ev: GuardedEvent) => any
: (this: Window, ev: WindowEventMap[K]) => any
type BoundEvent<K extends keyof WindowEventMap> = [
win: Window,

View File

@@ -52,8 +52,8 @@ interface CreateProxySockOpts {
type CreateProxySockCb = (
(err: undefined, result: net.Socket, triggerRetry: (err: Error) => void) => void
) & (
(err: Error) => void
)
(err: Error) => void
)
export const createProxySock = (opts: CreateProxySockOpts, cb: CreateProxySockCb) => {
if (opts.proxy.protocol !== 'https:' && opts.proxy.protocol !== 'http:') {

View File

@@ -46,12 +46,12 @@ const runnerEvents: RunnerEvent[] = [
type ReporterEvent =
'runner:restart'
| 'runner:abort'
| 'runner:console:log'
| 'runner:console:error'
| 'runner:show:snapshot'
| 'runner:hide:snapshot'
| 'reporter:restarted'
| 'runner:abort'
| 'runner:console:log'
| 'runner:console:error'
| 'runner:show:snapshot'
| 'runner:hide:snapshot'
| 'reporter:restarted'
const reporterEvents: ReporterEvent[] = [
// "go:to:file"

View File

@@ -8650,7 +8650,7 @@
dependencies:
"@types/node" "*"
"@typescript-eslint/eslint-plugin@4.18.0", "@typescript-eslint/eslint-plugin@^4.18.0":
"@typescript-eslint/eslint-plugin@4.18.0", "@typescript-eslint/eslint-plugin@^2.10.0", "@typescript-eslint/eslint-plugin@^2.2.0", "@typescript-eslint/eslint-plugin@^4.18.0":
version "4.18.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.18.0.tgz#50fbce93211b5b690895d20ebec6fe8db48af1f6"
integrity sha512-Lzkc/2+7EoH7+NjIWLS2lVuKKqbEmJhtXe3rmfA8cyiKnZm3IfLf51irnBcmow8Q/AptVV0XBZmBJKuUJTe6cQ==
@@ -8664,16 +8664,6 @@
semver "^7.3.2"
tsutils "^3.17.1"
"@typescript-eslint/eslint-plugin@^2.10.0", "@typescript-eslint/eslint-plugin@^2.2.0":
version "2.34.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.34.0.tgz#6f8ce8a46c7dea4a6f1d171d2bb8fbae6dac2be9"
integrity sha512-4zY3Z88rEE99+CNvTbXSyovv2z9PNOVffTWD2W8QF5s2prBQtwN2zadqERcrHpcR7O/+KMI3fcTAmUUhK/iQcQ==
dependencies:
"@typescript-eslint/experimental-utils" "2.34.0"
functional-red-black-tree "^1.0.1"
regexpp "^3.0.0"
tsutils "^3.17.1"
"@typescript-eslint/experimental-utils@2.34.0":
version "2.34.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz#d3524b644cdb40eebceca67f8cf3e4cc9c8f980f"