Match-id-af6f3229d00c36e13e9fa58a1a2cdb83f9dbe0ae
This commit is contained in:
commit
07e76be9c9
|
@ -1,2 +1,3 @@
|
||||||
**/node_modules
|
**/node_modules
|
||||||
build/
|
build/
|
||||||
|
*.d.ts
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
extends: [
|
extends: [
|
||||||
'eslint:recommended',
|
'eslint:recommended',
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended",
|
||||||
'prettier',
|
'prettier',
|
||||||
],
|
],
|
||||||
root: true,
|
root: true,
|
||||||
|
@ -41,6 +43,9 @@ module.exports = {
|
||||||
'no-for-of-loops/no-for-of-loops': 'error',
|
'no-for-of-loops/no-for-of-loops': 'error',
|
||||||
'no-function-declare-after-return/no-function-declare-after-return': 'error',
|
'no-function-declare-after-return/no-function-declare-after-return': 'error',
|
||||||
},
|
},
|
||||||
|
globals: {
|
||||||
|
isDev: true
|
||||||
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: [
|
files: [
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
declare var isDev: any;
|
/*
|
||||||
|
区分是否开发者模式
|
||||||
|
*/
|
||||||
|
declare var isDev: boolean;
|
||||||
|
|
|
@ -1,22 +1,29 @@
|
||||||
/**
|
/**
|
||||||
* Component的api setState和forceUpdate在实例生成阶段实现
|
* Component的api setState和forceUpdate在实例生成阶段实现
|
||||||
*/
|
*/
|
||||||
class Component<P,S,C> {
|
|
||||||
|
class Component<P, S, C> {
|
||||||
props: P;
|
props: P;
|
||||||
context: C;
|
context: C;
|
||||||
state: S | null;
|
state: S | null;
|
||||||
refs: any;
|
refs: any;
|
||||||
setState: any;
|
|
||||||
forceUpdate: any;
|
forceUpdate: any;
|
||||||
|
|
||||||
constructor(props: P, context: C) {
|
constructor(props: P, context: C) {
|
||||||
this.props = props;
|
this.props = props;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setState(state: S) {
|
||||||
|
if (isDev) {
|
||||||
|
console.error('Cant not call `this.setState` in the constructor of class component, it will do nothing');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 兼容三方件 react-lifecycles-compat,它会读取 isReactComponent 属性值,不添加会导致 eview-ui 官网白屏
|
// 兼容三方件 react-lifecycles-compat,它会读取 isReactComponent 属性值,不添加会导致 eview-ui 官网白屏
|
||||||
Component.prototype.isReactComponent = true;
|
Component.prototype.isReactComponent = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支持PureComponent
|
* 支持PureComponent
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./libs/**/src/**/*.ts",
|
"./libs/**/src/**/*.ts",
|
||||||
"libs/index.d.ts"
|
"libs/horizon/index.d.ts"
|
||||||
],
|
],
|
||||||
"exclude": ["node_modules", "**/*.spec.ts", "dev"],
|
"exclude": ["node_modules", "**/*.spec.ts", "dev"],
|
||||||
"types": ["node"],
|
"types": ["node"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue