mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-10 18:06:02 +00:00
chore: 使用 f2elint
This commit is contained in:
parent
327d4a3656
commit
3a925beb7a
@ -28,6 +28,8 @@ module.exports = {
|
|||||||
'eol-last': 0,
|
'eol-last': 0,
|
||||||
'react/no-find-dom-node': 0,
|
'react/no-find-dom-node': 0,
|
||||||
'no-case-declarations': 0,
|
'no-case-declarations': 0,
|
||||||
'@typescript-eslint/indent': 0
|
'@typescript-eslint/indent': 0,
|
||||||
|
'import/no-cycle': 0,
|
||||||
|
'@typescript-eslint/no-shadow': 0,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
17
package.json
17
package.json
@ -25,23 +25,20 @@
|
|||||||
"test": "lerna run test --stream",
|
"test": "lerna run test --stream",
|
||||||
"test:snapshot": "lerna run test:snapshot",
|
"test:snapshot": "lerna run test:snapshot",
|
||||||
"watchdog:build": "node ./scripts/watchdog.js",
|
"watchdog:build": "node ./scripts/watchdog.js",
|
||||||
"xima:fix": "xima fix",
|
"f2elint:scan": "f2elint scan -q -i ./packages/*/src",
|
||||||
"xima:scan": "xima scan --quiet"
|
"f2elint:fix": "f2elint fix -i ./packages/*/src"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"pre-commit": "xima exec lint-staged",
|
"pre-commit": "f2elint commit-file-scan",
|
||||||
"commit-msg": "xima exec commitlint -E HUSKY_GIT_PARAMS"
|
"commit-msg": "f2elint commit-msg-scan"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
|
||||||
"**/*.{css,scss,less}": "xima exec stylelint",
|
|
||||||
"**/*.{js,jsx,ts,tsx}": "xima exec eslint"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@ali/lerna": "^1",
|
"@ali/lerna": "^1",
|
||||||
"typescript": "^3.2.2",
|
"f2elint": "^2.0.1",
|
||||||
"xima": "^0.3.0"
|
"husky": "^7.0.4",
|
||||||
|
"typescript": "^3.2.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
编排模块
|
|
||||||
|
|
||||||
|
|
||||||
simulator/renderer 发 CDN
|
|
||||||
@ -47,9 +47,9 @@ function getTitle(title: string | I18nData | ReactElement) {
|
|||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class BorderContainer extends Component<{
|
export class BorderContainer extends Component<{
|
||||||
host: BuiltinSimulatorHost,
|
host: BuiltinSimulatorHost;
|
||||||
}, {
|
}, {
|
||||||
target?: ParentalNode,
|
target?: ParentalNode;
|
||||||
}> {
|
}> {
|
||||||
|
|
||||||
state = {} as any;
|
state = {} as any;
|
||||||
|
|||||||
@ -1004,7 +1004,7 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
|||||||
if (!domNode) return;
|
if (!domNode) return;
|
||||||
if (isElementNode(domNode) && !isDOMNodeVisible(domNode, this.viewport)) {
|
if (isElementNode(domNode) && !isDOMNodeVisible(domNode, this.viewport)) {
|
||||||
const { left, top } = domNode.getBoundingClientRect();
|
const { left, top } = domNode.getBoundingClientRect();
|
||||||
const { scrollTop = 0, scrollLeft = 0 } = this.contentDocument?.documentElement!;
|
const { scrollTop = 0, scrollLeft = 0 } = this.contentDocument?.documentElement || {};
|
||||||
opt.left = left + scrollLeft;
|
opt.left = left + scrollLeft;
|
||||||
opt.top = top + scrollTop;
|
opt.top = top + scrollTop;
|
||||||
scroll = true;
|
scroll = true;
|
||||||
|
|||||||
@ -62,7 +62,7 @@ export class LiveEditing {
|
|||||||
|
|
||||||
let setterPropElement = getSetterPropElement(targetElement, rootElement);
|
let setterPropElement = getSetterPropElement(targetElement, rootElement);
|
||||||
let propTarget = setterPropElement?.dataset.setterProp;
|
let propTarget = setterPropElement?.dataset.setterProp;
|
||||||
let matched: (LiveTextEditingConfig & { propElement?: HTMLElement; }) | undefined | null;
|
let matched: (LiveTextEditingConfig & { propElement?: HTMLElement }) | undefined | null;
|
||||||
if (liveTextEditing) {
|
if (liveTextEditing) {
|
||||||
if (propTarget) {
|
if (propTarget) {
|
||||||
// 已埋点命中 data-setter-prop="proptarget", 从 liveTextEditing 读取配置(mode|onSaveContent)
|
// 已埋点命中 data-setter-prop="proptarget", 从 liveTextEditing 读取配置(mode|onSaveContent)
|
||||||
@ -196,7 +196,8 @@ export interface SaveHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setCaret(event: MouseEvent) {
|
function setCaret(event: MouseEvent) {
|
||||||
const doc = event.view?.document!;
|
const doc = event.view?.document;
|
||||||
|
if (!doc) return;
|
||||||
const range = doc.caretRangeFromPoint(event.clientX, event.clientY);
|
const range = doc.caretRangeFromPoint(event.clientX, event.clientY);
|
||||||
if (range) {
|
if (range) {
|
||||||
selectRange(doc, range);
|
selectRange(doc, range);
|
||||||
|
|||||||
@ -14,6 +14,7 @@ export const getClosestClickableNode = (
|
|||||||
while (node) {
|
while (node) {
|
||||||
// 判断当前节点是否可点击
|
// 判断当前节点是否可点击
|
||||||
let canClick = canClickNode(node, event);
|
let canClick = canClickNode(node, event);
|
||||||
|
// eslint-disable-next-line no-loop-func
|
||||||
const lockedNode = getClosestNode(node!, (n) => {
|
const lockedNode = getClosestNode(node!, (n) => {
|
||||||
// 假如当前节点就是 locked 状态,要从当前节点的父节点开始查找
|
// 假如当前节点就是 locked 状态,要从当前节点的父节点开始查找
|
||||||
return !!(node?.isLocked ? n.parent?.isLocked : n.isLocked);
|
return !!(node?.isLocked ? n.parent?.isLocked : n.isLocked);
|
||||||
|
|||||||
@ -179,7 +179,7 @@ hotkey.bind(['command+z', 'ctrl+z'], (e) => {
|
|||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const selection = focusing.focusDesigner?.currentSelection;
|
const selection = focusing.focusDesigner?.currentSelection;
|
||||||
const curSelected = Array.from(selection?.selected!);
|
const curSelected = Array.from(selection?.selected || []);
|
||||||
his.back();
|
his.back();
|
||||||
selection?.selectAll(curSelected);
|
selection?.selectAll(curSelected);
|
||||||
});
|
});
|
||||||
@ -193,7 +193,7 @@ hotkey.bind(['command+y', 'ctrl+y', 'command+shift+z'], (e) => {
|
|||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const selection = focusing.focusDesigner?.currentSelection;
|
const selection = focusing.focusDesigner?.currentSelection;
|
||||||
const curSelected = Array.from(selection?.selected!);
|
const curSelected = Array.from(selection?.selected || []);
|
||||||
his.forward();
|
his.forward();
|
||||||
selection?.selectAll(curSelected);
|
selection?.selectAll(curSelected);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
background-color: rgba(0, 0, 0, 0.4);
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
//opacity: 0.9;
|
|
||||||
box-shadow: 0 0 6px grey;
|
box-shadow: 0 0 6px grey;
|
||||||
transform: translate(-10%, -50%);
|
transform: translate(-10%, -50%);
|
||||||
.lc-ghost {
|
.lc-ghost {
|
||||||
|
|||||||
@ -98,7 +98,7 @@ export class SettingField extends SettingPropEntry implements SettingEntry {
|
|||||||
return this._config;
|
return this._config;
|
||||||
}
|
}
|
||||||
|
|
||||||
private initItems(items: Array<FieldConfig | CustomView>, settingFieldCollector?: { (name: string | number, field: SettingField): void; (name: string, field: SettingField): void; }) {
|
private initItems(items: Array<FieldConfig | CustomView>, settingFieldCollector?: { (name: string | number, field: SettingField): void; (name: string, field: SettingField): void }) {
|
||||||
this._items = items.map((item) => {
|
this._items = items.map((item) => {
|
||||||
if (isCustomView(item)) {
|
if (isCustomView(item)) {
|
||||||
return item;
|
return item;
|
||||||
|
|||||||
@ -292,7 +292,7 @@ export class SettingPropEntry implements SettingEntry {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyValueChange(oldValue: any, newValue:any) {
|
notifyValueChange(oldValue: any, newValue: any) {
|
||||||
this.editor.emit(GlobalEvent.Node.Prop.Change, { node: this.getNode(), prop: this, oldValue, newValue });
|
this.editor.emit(GlobalEvent.Node.Prop.Change, { node: this.getNode(), prop: this, oldValue, newValue });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -72,7 +72,7 @@ export class DocumentModel {
|
|||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
private _addons: Array<{ name: string, exportData: any }> = [];
|
private _addons: Array<{ name: string; exportData: any }> = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模拟器
|
* 模拟器
|
||||||
@ -634,7 +634,7 @@ export class DocumentModel {
|
|||||||
) {
|
) {
|
||||||
let visitorResult = {};
|
let visitorResult = {};
|
||||||
if (!visitorName) {
|
if (!visitorName) {
|
||||||
/* tslint:disable no-console */
|
/* eslint-disable-next-line no-console */
|
||||||
console.warn('Invalid or empty RootNodeVisitor name.');
|
console.warn('Invalid or empty RootNodeVisitor name.');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -933,7 +933,7 @@ export class Node<Schema extends NodeSchema = NodeSchema> {
|
|||||||
return this.props;
|
return this.props;
|
||||||
}
|
}
|
||||||
|
|
||||||
onChildrenChange(fn: (param?: { type: string, node: Node }) => void): (() => void) | undefined {
|
onChildrenChange(fn: (param?: { type: string; node: Node }) => void): (() => void) | undefined {
|
||||||
const wrappedFunc = wrapWithEventSwitch(fn);
|
const wrappedFunc = wrapWithEventSwitch(fn);
|
||||||
return this.children?.onChange(wrappedFunc);
|
return this.children?.onChange(wrappedFunc);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { TransformStage } from '../transform-stage';
|
|||||||
|
|
||||||
const { set: mobxSet, isObservableArray } = mobx;
|
const { set: mobxSet, isObservableArray } = mobx;
|
||||||
export const UNSET = Symbol.for('unset');
|
export const UNSET = Symbol.for('unset');
|
||||||
|
// eslint-disable-next-line no-redeclare
|
||||||
export type UNSET = typeof UNSET;
|
export type UNSET = typeof UNSET;
|
||||||
|
|
||||||
export interface IPropParent {
|
export interface IPropParent {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { BuiltinSimulatorRenderer } from './builtin-simulator/renderer';
|
|||||||
import { Node, ParentalNode } from './document';
|
import { Node, ParentalNode } from './document';
|
||||||
|
|
||||||
export type AutoFit = '100%';
|
export type AutoFit = '100%';
|
||||||
|
// eslint-disable-next-line no-redeclare
|
||||||
export const AutoFit = '100%';
|
export const AutoFit = '100%';
|
||||||
|
|
||||||
export interface IViewport extends IScrollable {
|
export interface IViewport extends IScrollable {
|
||||||
|
|||||||
@ -2,6 +2,6 @@ import Logger, { Level } from 'zen-logger';
|
|||||||
|
|
||||||
export { Logger };
|
export { Logger };
|
||||||
|
|
||||||
export function getLogger(config: { level: Level, bizName: string }): Logger {
|
export function getLogger(config: { level: Level; bizName: string }): Logger {
|
||||||
return new Logger(config);
|
return new Logger(config);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user