Skip to content

Commit a8de4b9

Browse files
committed
chore: 修改 code style 以及配置 lint & test action
1 parent dbf126e commit a8de4b9

File tree

13 files changed

+49
-17
lines changed

13 files changed

+49
-17
lines changed

.github/workflows/test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: lint & test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
setup:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: checkout
10+
uses: actions/checkout@v2
11+
12+
- name: install
13+
run: npm i && npm run setup:skip-build
14+
15+
lint:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: checkout
19+
uses: actions/checkout@v2
20+
21+
- name: lint
22+
run: npm run lint
23+
needs: setup
24+
25+
test-designer:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: checkout
29+
uses: actions/checkout@v2
30+
31+
- name: lint
32+
run: cd packages/designer && npm test
33+
needs: setup

modules/code-generator/src/utils/resultHelper.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ export function flattenResult(dir: ResultDir, cwd = ''): FlattenFile[] {
5353
),
5454
].concat(
5555
...dir.dirs.map((subDir) =>
56-
flattenResult(subDir, [cwd, subDir.name].filter((x) => x !== '' && x !== '.').join('/')),
57-
),
56+
flattenResult(subDir, [cwd, subDir.name].filter((x) => x !== '' && x !== '.').join('/'))),
5857
);
5958
}

modules/material-parser/src/parse/js/resolver/resolveImport.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export function resolveToImport(initialPath) {
5050
}
5151
pathBuffer.unshift(...paths);
5252
}
53+
// eslint-disable-next-line no-fallthrough
5354
case 'Identifier':
5455
case 'JSXIdentifier': {
5556
const valuePath = resolveToValue(path);

modules/material-parser/src/parse/js/utils/getComposedPath.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default function getComposedPropTypesPath(documentation, propName, p) {
2525
const ast = parser.parse(fileContent);
2626

2727
visit(ast, {
28+
// eslint-disable-next-line no-loop-func
2829
visitAssignmentExpression(path: any) {
2930
// Ignore anything that is not `exports.X = ...;` or
3031
// `module.exports = ...;`

modules/material-parser/src/parse/ts/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ function getDocgenTypeHelper(
299299
name: 'union',
300300
// @ts-ignore
301301
value: type.types.map((t) =>
302-
getDocgenTypeHelper(checker, t, true, getNextParentIds(parentIds, type)),
303-
),
302+
getDocgenTypeHelper(checker, t, true, getNextParentIds(parentIds, type))),
304303
});
305304
} else if (isComplexType(type)) {
306305
return makeResult({
@@ -494,8 +493,7 @@ export default function parseTS(filePath: string, args: IParseArgs): ComponentDo
494493

495494
log('ts config path is', tsConfigPath);
496495
const { config, error } = ts.readConfigFile(tsConfigPath, (filename) =>
497-
readFileSync(filename, 'utf8'),
498-
);
496+
readFileSync(filename, 'utf8'));
499497

500498
if (error !== undefined) {
501499
const errorText = `Cannot load custom tsconfig.json from provided path: ${tsConfigPath}, with error code: ${error.code}, message: ${error.messageText}`;

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"setup:test": "./scripts/setup-for-test.sh",
2525
"setup:skip-build": "./scripts/setup-skip-build.sh",
2626
"start": "./scripts/start.sh",
27-
"start:demo": "./scripts/start.sh @ali/lowcode-demo",
2827
"test": "lerna run test --stream",
2928
"test:snapshot": "lerna run test:snapshot",
3029
"watchdog:build": "node ./scripts/watchdog.js",

packages/editor-core/src/editor.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export declare interface Editor extends StrictEventEmitter<EventEmitter, GlobalE
3737
getPreference(): Preference;
3838
}
3939

40+
// eslint-disable-next-line no-redeclare
4041
export class Editor extends (EventEmitter as any) implements IEditor {
4142
/**
4243
* Ioc Container

packages/editor-core/src/utils/app-preset.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ window.__newFunc = (funContext: string): ((...args: any[]) => any) => {
2828
};
2929

3030
// 关闭浏览器前提醒,只有产生过交互才会生效
31-
window.onbeforeunload = function (e: Event): string | void {
31+
window.onbeforeunload = function (e: Event): string {
3232
const ev = e || window.event;
3333
// 本地调试不生效
3434
if (location.href.indexOf('localhost') > 0) {
35-
return;
35+
return '';
3636
}
3737
const msg = '您确定要离开此页面吗?';
3838
ev.cancelBubble = true;

packages/editor-core/src/utils/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import Logger, { Level } from 'zen-logger';
22

33
export { Logger };
44

5-
export function getLogger(config: { level: Level, bizName: string }): Logger {
5+
export function getLogger(config: { level: Level; bizName: string }): Logger {
66
return new Logger(config);
77
}

packages/editor-core/src/utils/preference.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default class Preference {
1616
return `${STORAGE_KEY_PREFIX}_${moduleKey}.${key}`;
1717
}
1818

19-
set(key: string, value:any, module?: string) {
19+
set(key: string, value: any, module?: string) {
2020
if (!key || typeof key !== 'string' || key.length === 0) {
2121
logger.error('Invalid key when setting preference', key);
2222
return;
@@ -26,7 +26,7 @@ export default class Preference {
2626
store.set(storageKey, value);
2727
}
2828

29-
get(key: string, module: string) : any {
29+
get(key: string, module: string): any {
3030
if (!key || typeof key !== 'string' || key.length === 0) {
3131
logger.error('Invalid key when getting from preference', key);
3232
return;
@@ -44,7 +44,7 @@ export default class Preference {
4444
* @returns {boolean}
4545
* @memberof Preference
4646
*/
47-
contains(key: string, module: string) : boolean {
47+
contains(key: string, module: string): boolean {
4848
if (!key || typeof key !== 'string' || key.length === 0) {
4949
logger.error('Invalid key when getting from preference', key);
5050
return false;

0 commit comments

Comments
 (0)