Skip to content

Commit 3d16970

Browse files
authored
Merge pull request #256 from db-ui/refactor-xo-feedback
refactor(xo): optimizations
2 parents 0ed9e6d + 505b0d7 commit 3d16970

File tree

15 files changed

+43
-46
lines changed

15 files changed

+43
-46
lines changed

packages/components/plugins/power-apps/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const ChildProcess = require('child_process');
2-
const Buff = require('buffer');
1+
const ChildProcess = require('node:child_process');
2+
const Buff = require('node:buffer');
33

44
module.exports = () => ({
55
json: {

packages/components/scripts/post-build/copy-files.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ const Fse = require('fs-extra');
22
const Frameworks = require('./framworks');
33

44
module.exports = () => {
5-
[
5+
for (const file of [
66
'package.json',
77
'angular.json',
88
'tsconfig.json',
99
'ng-package.json',
1010
'vite.config.ts'
11-
].forEach((file) => {
12-
Frameworks.forEach((framework) => {
11+
]) {
12+
for (const framework of Frameworks) {
1313
const resolvedFramework =
1414
framework === 'vue' ? `vue/vue3` : framework;
1515
if (
@@ -20,6 +20,6 @@ module.exports = () => {
2020
`../../output/${resolvedFramework}/${file}`
2121
);
2222
}
23-
});
24-
});
23+
}
24+
}
2525
};

packages/components/scripts/post-build/react.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = () => {
66
try {
77
const cleanName = component.name
88
.split('-')
9-
.map((part) => `${part[0].toUpperCase()}${part.substring(1)}`)
9+
.map((part) => `${part[0].toUpperCase()}${part.slice(1)}`)
1010
.join('');
1111
const stateName = `DB${cleanName}State`;
1212

@@ -32,14 +32,14 @@ module.exports = () => {
3232
];
3333
}
3434

35-
replacements.forEach((replacement) => {
35+
for (const replacement of replacements) {
3636
const option = {
3737
files: tsxFile,
3838
from: replacement.from,
3939
to: replacement.to
4040
};
4141
Replace.replaceInFileSync(option);
42-
});
42+
}
4343
} catch (error) {
4444
console.error('Error occurred:', error);
4545
}

packages/components/scripts/post-build/vue.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ module.exports = () => {
6363
];
6464
}
6565

66-
replacements.forEach((replacement) => {
66+
for (const replacement of replacements) {
6767
const option = {
6868
files: vueFile,
6969
from: replacement.from,
7070
to: replacement.to
7171
};
7272
Replace.replaceInFileSync(option);
73-
});
73+
}
7474
} catch (error) {
7575
console.error('Error occurred:', error);
7676
}

packages/components/src/components/button/button.lite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { onMount, Show, useMetadata, useStore } from '@builder.io/mitosis';
2-
import type { DBButtonProps, DBButtonState } from './model';
32
import { DBIcon } from '../icon';
3+
import type { DBButtonProps, DBButtonState } from './model';
44

55
useMetadata({
66
isAttachedToShadowDom: true,

packages/components/src/components/button/model.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {
2-
ClickEventProps,
3-
ClickEventState,
4-
GlobalProps,
5-
GlobalState
2+
type ClickEventProps,
3+
type ClickEventState,
4+
type GlobalProps,
5+
type GlobalState
66
} from '../../shared/model';
77

88
export type DBButtonDefaultProps = {

packages/components/src/components/card/model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
2-
ClickEventProps,
3-
ClickEventState,
4-
GlobalProps,
5-
GlobalState,
6-
ImageProps
2+
type ClickEventProps,
3+
type ClickEventState,
4+
type GlobalProps,
5+
type GlobalState,
6+
type ImageProps
77
} from '../../shared/model';
88

99
export type DBCardDefaultProps = {

packages/components/src/components/divider/divider.lite.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { onMount, Show, useMetadata, useStore } from '@builder.io/mitosis';
2-
import { DBDividerState, DBDividerProps } from './model';
2+
import { type DBDividerState, type DBDividerProps } from './model';
33

44
useMetadata({
55
isAttachedToShadowDom: true,

packages/components/src/components/divider/model.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { GlobalProps, GlobalState } from '../../shared/model';
1+
import { type GlobalProps, type GlobalState } from '../../shared/model';
22

3-
export interface DBDividerDefaultProps {
3+
export type DBDividerDefaultProps = {
44
margin?: 'none' | '_';
55
variant?: 'horizontal' | 'vertical';
6-
}
6+
};
77

88
export type DBDividerProps = DBDividerDefaultProps & GlobalProps;
99

packages/components/src/components/icon/model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { GlobalProps, GlobalState } from '../../shared/model';
1+
import { type GlobalProps, type GlobalState } from '../../shared/model';
22

33
export type DBIconDefaultProps = {
44
icon?: string;

0 commit comments

Comments
 (0)