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[]; domain?: any[];
} }
export interface IScaleOptions { export interface IScaleOptions {
[key: string]: IScale; [key: string]: IScale | undefined;
} }
export interface IStyleScale { export interface IStyleScale {
scale: any; scale: any;

View File

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

View File

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

View File

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