fix: lint error

This commit is contained in:
thinkinggis 2021-07-03 22:50:25 +08:00
parent a75f9511e3
commit 0e5aad2b12
4 changed files with 8 additions and 9 deletions

View File

@ -60,7 +60,7 @@ export interface IScaleOption {
domain?: any[];
}
export interface IScaleOptions {
[key: string]: IScale;
[key: string]: IScale | undefined;
}
export interface IStyleScale {
scale: any;

View File

@ -229,7 +229,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
return this.container;
}
public addPlugin(plugin: ILayerPlugin) {
public addPlugin(plugin: ILayerPlugin): ILayer {
// TODO: 控制插件注册顺序
// @example:
// pointLayer.addPlugin(new MyCustomPlugin(), {
@ -457,7 +457,6 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
};
return this;
}
public setData(data: any, options?: ISourceCFG) {
if (this.inited) {
this.layerSource.setData(data, options);
@ -498,7 +497,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
}
return this;
}
public scale(field: string | IScaleOptions, cfg: IScale) {
public scale(field: string | number | IScaleOptions, cfg?: IScale) {
if (isObject(field)) {
this.scaleOptions = {
...this.scaleOptions,
@ -528,7 +527,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
return this;
}
public active(options: IActiveOption) {
public active(options: IActiveOption | boolean) {
const activeOption: Partial<ILayerConfig> = {};
activeOption.enableHighlight = isObject(options) ? true : options;
if (isObject(options)) {

View File

@ -209,7 +209,7 @@ export default class FeatureScalePlugin implements ILayerPlugin {
): IStyleScale {
// scale 支持根据视觉通道和字段
const scaleOption: IScale | undefined =
this.scaleOptions[name] && this.scaleOptions[name].field === field
this.scaleOptions[name] && this.scaleOptions[name]?.field === field
? this.scaleOptions[name]
: this.scaleOptions[field];
const styleScale: IStyleScale = {

View File

@ -26,11 +26,11 @@ export default {
namedExports: {
eventemitter3: [ 'EventEmitter' ],
lodash: [ 'merge' ],
// inversify: ['inject','injectable']
inversify: [ 'inject', 'injectable' ]
},
dynamicRequireTargets: [
'node_modules/inversify/lib/syntax/binding_{on,when}_syntax.js',
],
'node_modules/inversify/lib/syntax/binding_{on,when}_syntax.js'
]
}),
buble({
transforms: { generator: false }