Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: adds swc-plugin-de-indent-template-literal to remove indentation of consoles",
"packageName": "@fluentui/react-dialog",
"email": "bernardo.sunderhus@gmail.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: adds swc-plugin-de-indent-template-literal to remove indentation of consoles",
"packageName": "@fluentui/react-tree",
"email": "bernardo.sunderhus@gmail.com",
"dependentChangeType": "patch"
}
3 changes: 3 additions & 0 deletions packages/react-components/react-dialog/.swcrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"/**/*.test.tsx"
],
"jsc": {
"experimental": {
"plugins": [["swc-plugin-de-indent-template-literal", {}]]
},
"parser": {
"syntax": "typescript",
"tsx": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ function childrenToTriggerAndContent(
if (process.env.NODE_ENV !== 'production') {
if (childrenArray.length !== 1 && childrenArray.length !== 2) {
// eslint-disable-next-line no-console
console.warn(
'Dialog must contain at least one child <DialogSurface/>,\n' +
'and at most two children <DialogTrigger/> <DialogSurface/> (in this order)',
);
console.warn(/* #__DE-INDENT__ */ `
@fluentui/react-dialog [useDialog]:
Dialog must contain at least one child <DialogSurface/>,
and at most two children <DialogTrigger/> <DialogSurface/> (in this order).
`);
}
}
switch (childrenArray.length) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ export function useFocusFirstElement(open: boolean, modalType: DialogModalType)
dialogRef.current?.focus(); // https://github.com/microsoft/fluentui/issues/25150
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.warn(
[
'@fluentui/react-dialog: a Dialog should have at least one focusable element inside DialogSurface.',
'Please add at least a close button either on `DialogTitle` action slot or inside `DialogActions`',
].join('\n'),
);
console.warn(/** #__DE-INDENT__ */ `
@fluentui/react-dialog [useFocusFirstElement]:
A Dialog should have at least one focusable element inside DialogSurface.
Please add at least a close button either on \`DialogTitle\` action slot or inside \`DialogActions\`
`);
}
}
}, [findFirstFocusable, open, modalType, targetDocument]);
Expand Down
3 changes: 3 additions & 0 deletions packages/react-components/react-tree/.swcrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"/**/*.test.tsx"
],
"jsc": {
"experimental": {
"plugins": [["swc-plugin-de-indent-template-literal", {}]]
},
"parser": {
"syntax": "typescript",
"tsx": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export function createNextFlatCheckedItems(
if (!treeItem) {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.error(`useHeadlessFlatTree: tree item ${data.value} not found`);
console.error(/* #__DE-INDENT__ */ `
@fluentui/react-tree [useHeadlessFlatTree]:
Tree item ${data.value} not found.
`);
}
return previousCheckedItems;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ function warnIfNoProperPropsRootTree(props: Pick<TreeProps, 'aria-label' | 'aria
if (process.env.NODE_ENV === 'development') {
if (!props['aria-label'] && !props['aria-labelledby']) {
// eslint-disable-next-line no-console
console.warn('Tree must have either a `aria-label` or `aria-labelledby` property defined');
console.warn(/* #__DE-INDENT__ */ `
@fluentui/react-tree [useRootTree]:
Tree must have either a \`aria-label\` or \`aria-labelledby\` property defined
`);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ export function createHeadlessTree<Props extends HeadlessTreeItemProps>(
if (!parentItem) {
if (process.env.NODE_ENV === 'development') {
// eslint-disable-next-line no-console
console.error(
`HeadlessTree: item ${props.value} is wrongly positioned, did you properly ordered provided item props? make sure provided items are organized, parents should come before children`,
);
console.error(/* #__DE-INDENT__ */ `
@fluentui/react-tree [createHeadlessTree]:
TreeItem "${props.value}" is wrongly positioned, did you properly ordered provided item props? make sure provided items are organized, parents should come before children
`);
}
return;
}
Expand Down Expand Up @@ -179,7 +180,10 @@ function createHeadlessTreeRootItem(): HeadlessTreeItem<HeadlessTreeItemProps> {
getTreeItemProps: () => {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.error('HeadlessTree: internal error, trying to access treeitem props from invalid root element');
console.error(/* #__DE-INDENT__ */ `
@fluentui/react-tree [createHeadlessTree]:
Internal error, trying to access treeitem props from invalid root element
`);
}
return {
id: headlessTreeRootId,
Expand All @@ -194,14 +198,20 @@ function createHeadlessTreeRootItem(): HeadlessTreeItem<HeadlessTreeItemProps> {
get index() {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.error('HeadlessTree: internal error, trying to access treeitem props from invalid root element');
console.error(/* #__DE-INDENT__ */ `
@fluentui/react-tree [createHeadlessTree]:
Internal error, trying to access treeitem props from invalid root element
`);
}
return -1;
},
get position() {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line no-console
console.error('HeadlessTree: internal error, trying to access treeitem props from invalid root element');
console.error(/* #__DE-INDENT__ */ `
@fluentui/react-tree [createHeadlessTree]:
Internal error, trying to access treeitem props from invalid root element
`);
}
return -1;
},
Expand Down