Chore: 修复部分lint 警告,pre-commit 移除build命令 (#1285)

* chore: lint unuse

* chore: pre commit command

* chore: pre-commit 去除build 命令
This commit is contained in:
@thinkinggis 2022-08-11 14:04:56 +08:00 committed by GitHub
parent 089d172324
commit 101fe3744f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 108 additions and 171 deletions

View File

@ -18,3 +18,4 @@ gatsby-*.js
global.d.ts
jest.config.js
.eslintrc.*
packages/utils/src/mini-adapter/

View File

@ -15,8 +15,9 @@ module.exports = {
ecmaVersion: 12,
sourceType: 'module'
},
plugins: ['@typescript-eslint'],
plugins: ['@typescript-eslint',"unused-imports"],
rules: {
"unused-imports/no-unused-imports": "error",
'@typescript-eslint/no-loss-of-precision':0,
'@typescript-eslint/no-inferrable-types': 0,
'no-constant-condition': 0,
@ -38,5 +39,5 @@ module.exports = {
alwaysTryTypes: true,
},
},
},
}
};

View File

@ -1,4 +1,4 @@
import { PointLayer, ImageLayer, Scene } from '@antv/l7';
import { ImageLayer, Scene } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
import React, { useEffect } from 'react';

View File

@ -1,4 +1,4 @@
import { PointLayer, LineLayer, Scene, RasterLayer } from '@antv/l7';
import { LineLayer, Scene } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
import React, { useEffect } from 'react';
@ -60,21 +60,21 @@ export default () => {
'#2EA9A1',
'#206C7C',
],
weights: [0.1, 0.1, 0.1, 0.1, 0.1, 0.5]
weights: [0.1, 0.1, 0.1, 0.1, 0.1, 0.5],
},
});
scene.on('loaded', () => {
scene.addLayer(layer);
})
}, [])
});
}, []);
return (
<div
id="map"
style={{
height: '500px',
position: 'relative'
position: 'relative',
}}
/>
);
}
};

View File

@ -1,4 +1,4 @@
import { PointLayer, ImageLayer, Scene, RasterLayer } from '@antv/l7';
import { Scene, RasterLayer } from '@antv/l7';
import { GaodeMap } from '@antv/l7-maps';
import React, { useEffect } from 'react';

View File

@ -83,9 +83,8 @@
"enzyme-adapter-react-16": "^1.5.0",
"enzyme-to-json": "^3.0.0-beta6",
"eslint": "^7.32.0",
"eslint-config-egg": "^7.5.1",
"eslint-plugin-html": "^6.0.0",
"eslint-plugin-no-autofix": "^1.2.3",
"eslint-plugin-unused-imports": "^2.0.0",
"father": "^4.0.0-rc.2",
"gatsby": "2.32.13",
"gatsby-plugin-google-analytics": "^2.1.27",
@ -166,6 +165,7 @@
"postbuild": "yarn build:declarations",
"build:declarations": "lerna run tsc --stream --no-bail",
"lint:fix": "prettier --write packages/**/src/**/*.ts packages/site/docs/api/**/*.md packages/site/docs/api/*.md dev-demos/**/**/*.tsx *.md",
"lint:src": "eslint packages/**/src/**/*.ts dev-demos/**/**/*.tsx ",
"lint:examples": "eslint packages/site/examples --fix --ext .js",
"lint:css": "stylelint 'packages/**/src/**/*.js{,x}'",
"lint": "run-p -c lint:*",
@ -197,7 +197,7 @@
],
"husky": {
"hooks": {
"pre-commit": "yarn run build && yarn run test-cover",
"pre-commit": "yarn run prebuild && yarn run test-cover",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},

View File

@ -1,4 +1,3 @@
import { IControlOption } from '@antv/l7-core';
import { DOM } from '@antv/l7-utils';
import Control, { PositionType } from './BaseControl';

View File

@ -1,4 +1,4 @@
import { mat3, mat4, vec3, vec4 } from 'gl-matrix';
import { vec3, vec4 } from 'gl-matrix';
export function getAngle(angle: number | undefined) {
if (angle === undefined) {

View File

@ -2,7 +2,6 @@
import { SyncBailHook, SyncHook, SyncWaterfallHook } from '@antv/async-hook';
import {
BlendType,
gl,
IActiveOption,
IAnimateOption,
IAttrubuteAndElements,
@ -33,17 +32,12 @@ import {
IScale,
IScaleOptions,
IShaderModuleService,
ISource,
ISourceCFG,
IStyleAttributeInitializationOptions,
IStyleAttributeService,
IStyleAttributeUpdateOptions,
LayerEventType,
lazyInject,
LegendItems,
ScaleAttributeType,
ScaleTypeName,
ScaleTypes,
StyleAttributeField,
StyleAttributeOption,
Triangulation,

View File

@ -29,7 +29,7 @@ import {
} from '@antv/l7-core';
import { rgb2arr } from '@antv/l7-utils';
import { color } from 'd3-color';
import { isEqual, isFunction, isNumber, isString } from 'lodash';
import { isEqual, isNumber, isString } from 'lodash';
import { BlendTypes } from '../utils/blend';
export type styleSingle =

View File

@ -1,6 +1,6 @@
import { IAnimateOption, IMapService } from '@antv/l7-core';
import { IColorRamp, IImagedata } from '@antv/l7-utils';
import { styleOffset, styleSingle } from '../core/BaseModel';
import { styleOffset } from '../core/BaseModel';
import { anchorType } from '../utils/symbol-layout';
export enum lineStyleType {
'solid' = 0.0,

View File

@ -1,13 +1,12 @@
import { IEncodeFeature } from '@antv/l7-core';
import {
aProjectFlat,
calculateCentroid,
calculatePointsCenterAndRadius,
lngLatToMeters,
} from '@antv/l7-utils';
import earcut from 'earcut';
// @ts-ignore
import { mat4, vec3 } from 'gl-matrix';
import { vec3 } from 'gl-matrix';
import {
EARTH_RADIUS,
EARTH_RADIUS_OUTER,
@ -16,7 +15,6 @@ import {
primitiveSphere,
} from '../earth/utils';
import ExtrudePolyline from '../utils/extrude_polyline';
import SimpleLine from '../utils/simpleLine';
import extrudePolygon, {
extrude_PolygonNormal,
fillPolygon,

View File

@ -1,4 +1,3 @@
import { IEncodeFeature, IParseDataItem } from '@antv/l7-core';
// @ts-ignore
export function heatMap3DTriangulation(width: number, height: number) {

View File

@ -4,7 +4,6 @@ import {
IGlobalConfigService,
ILayer,
ILayerPlugin,
ILngLat,
IMapService,
IParseDataItem,
IStyleAttribute,
@ -13,7 +12,7 @@ import {
TYPES,
} from '@antv/l7-core';
import { Version } from '@antv/l7-maps';
import { isColor, normalize, rgb2arr, unProjectFlat } from '@antv/l7-utils';
import { isColor, normalize, rgb2arr } from '@antv/l7-utils';
import { inject, injectable } from 'inversify';
import { cloneDeep } from 'lodash';
import 'reflect-metadata';

View File

@ -1,10 +1,4 @@
import {
ILayer,
ILayerPlugin,
ILngLat,
IMapService,
TYPES,
} from '@antv/l7-core';
import { ILayer, ILayerPlugin, IMapService, TYPES } from '@antv/l7-core';
import Source, {
DEFAULT_DATA,
DEFAULT_PARSER,

View File

@ -13,7 +13,7 @@ import {
TYPES,
} from '@antv/l7-core';
import { IParseDataItem } from '@antv/l7-source';
import { extent, ticks } from 'd3-array';
import { extent } from 'd3-array';
import * as d3interpolate from 'd3-interpolate';
import * as d3 from 'd3-scale';
import { inject, injectable } from 'inversify';

View File

@ -1,4 +1,4 @@
import { ILayer, ILayerPlugin, IMapService, TYPES } from '@antv/l7-core';
import { ILayer, ILayerPlugin } from '@antv/l7-core';
import { injectable } from 'inversify';
import 'reflect-metadata';
/**

View File

@ -1,4 +1,4 @@
import { ILayer, ILayerPlugin, IMapService, TYPES } from '@antv/l7-core';
import { ILayer, ILayerPlugin } from '@antv/l7-core';
import { injectable } from 'inversify';
import 'reflect-metadata';
/**

View File

@ -1,16 +1,4 @@
import {
AttributeType,
gl,
IEncodeFeature,
ILayer,
ILayerPlugin,
IModelUniform,
IRasterParserDataItem,
IStyleAttributeService,
ITexture2D,
lazyInject,
TYPES,
} from '@antv/l7-core';
import { gl, IModelUniform, ITexture2D } from '@antv/l7-core';
import { generateColorRamp, IColorRamp } from '@antv/l7-utils';
import BaseLayer from '../core/BaseLayer';

View File

@ -1,4 +1,4 @@
import { Tile, TilesetManager } from '@antv/l7-utils';
import { Tile } from '@antv/l7-utils';
import BaseTileLayer from './tileLayer/baseTileLayer';
export class TMSTileLayer extends BaseTileLayer {

View File

@ -1,4 +1,4 @@
import { BlendType, gl, IBlendOptions, IBlendTypes } from '@antv/l7-core';
import { BlendType, gl, IBlendTypes } from '@antv/l7-core';
export const BlendTypes: IBlendTypes = {
[BlendType.additive]: {
enable: true,

View File

@ -1,12 +1,9 @@
import {
gl,
ILayer,
IStyleAttributeUpdateOptions,
ITexture2D,
StyleAttributeField,
StyleAttributeOption,
} from '@antv/l7-core';
import { rgb2arr } from '@antv/l7-utils';
import { isFunction, isNumber, isString } from 'lodash';
/**
* style

View File

@ -1,12 +1,4 @@
import {
IGlobalConfigService,
ILayer,
ILayerPlugin,
IPass,
IPostProcessingPass,
IRendererService,
TYPES,
} from '@antv/l7-core';
import { ILayer, IPass, IPostProcessingPass } from '@antv/l7-core';
/**
* 'blurH' -> ['blurH', {}]

View File

@ -1,4 +1,4 @@
import { aProjectFlat, lngLatToMeters } from '@antv/l7-utils';
import { aProjectFlat } from '@antv/l7-utils';
import { vec2 } from 'gl-matrix';
export function computeMiter(
tangent: vec2,

View File

@ -1,5 +1,3 @@
import { type } from 'os';
interface IPoint {
x: number;
y: number;

View File

@ -1,5 +1,4 @@
import { wrap } from '../util';
import LngLatBounds from './lng_lat_bounds';
export const earthRadius = 6371008.8;
export type LngLatLike =
| LngLat

View File

@ -1,10 +1,8 @@
// @ts-ignore
import { isMini } from '@antv/l7-utils';
import { mat2, mat4, vec3, vec4 } from 'gl-matrix';
import Point, { PointLike } from '../geo/point';
import { mat2, mat4, vec4 } from 'gl-matrix';
import Point from '../geo/point';
import { clamp, interpolate, wrap } from '../util';
import Aabb from '../utils/Aabb';
import Frustum from '../utils/primitives';
import EdgeInsets, { IPaddingOptions } from './edge_insets';
import LngLat from './lng_lat';
import LngLatBounds from './lng_lat_bounds';

View File

@ -1,8 +1,7 @@
// @ts-ignore
import { EarthMap } from '../earthmap';
import Point from '../geo/point';
import { Map } from '../map';
import { MapMouseEvent, MapTouchEvent, MapWheelEvent } from './events';
import { MapMouseEvent } from './events';
export default class BlockableMapEventHandler {
private map: Map | EarthMap;
private delayContextMenu: boolean;

View File

@ -16,11 +16,10 @@ import {
IStatusOptions,
IViewport,
MapServiceEvent,
MapStyle,
TYPES,
} from '@antv/l7-core';
import { DOM } from '@antv/l7-utils';
import { mat4, vec2, vec3 } from 'gl-matrix';
import { mat4, vec3 } from 'gl-matrix';
import { inject, injectable } from 'inversify';
import 'reflect-metadata';
import { IAMapEvent, IAMapInstance } from '../../typings/index';

View File

@ -16,16 +16,14 @@ import {
IStatusOptions,
IViewport,
MapServiceEvent,
MapStyle,
Point,
TYPES,
} from '@antv/l7-core';
import { amap2Project, DOM } from '@antv/l7-utils';
import { mat4, vec2, vec3 } from 'gl-matrix';
import { inject, injectable } from 'inversify';
import 'reflect-metadata';
import { IAMapEvent, IAMapInstance } from '../../typings/index';
import { ISimpleMapCoord, SimpleMapCoord } from '../simpleMapCoord';
import { IAMapInstance } from '../../typings/index';
import { SimpleMapCoord } from '../simpleMapCoord';
import { toPaddingOptions } from '../utils';
import { Version } from '../version';
import './logo.css';

View File

@ -1,4 +1,4 @@
import { IMapCamera, IViewport } from '@antv/l7-core';
import { IViewport } from '@antv/l7-core';
import { mat4, vec3 } from 'gl-matrix';
import WebMercatorViewport from 'viewport-mercator-project';

View File

@ -18,9 +18,9 @@ import {
TYPES,
} from '@antv/l7-core';
import { DOM } from '@antv/l7-utils';
import { mat4, vec2, vec3 } from 'gl-matrix';
import { mat4, vec3 } from 'gl-matrix';
import { inject, injectable } from 'inversify';
import mapboxgl, { IControl, Map } from 'mapbox-gl';
import mapboxgl, { Map } from 'mapbox-gl';
// tslint:disable-next-line:no-submodule-imports
import 'mapbox-gl/dist/mapbox-gl.css';
import 'reflect-metadata';

View File

@ -1,5 +1,4 @@
import {
gl,
IFramebuffer,
IFramebufferInitializationOptions,
IRenderbuffer,

View File

@ -8,7 +8,7 @@ import {
IUniform,
} from '@antv/l7-core';
import regl from 'l7regl';
import { cloneDeep, extend, isPlainObject, isTypedArray } from 'lodash';
import { cloneDeep, isPlainObject, isTypedArray } from 'lodash';
import {
blendEquationMap,
blendFuncMap,

View File

@ -1,9 +1,4 @@
import {
IClusterOptions,
IParserData,
ISourceCFG,
ITransform,
} from '@antv/l7-core';
import { IClusterOptions, IParserData } from '@antv/l7-core';
// @ts-ignore
// tslint:disable-next-line:no-submodule-imports
import Supercluster from 'supercluster/dist/supercluster';

View File

@ -1,12 +1,7 @@
import { aProjectFlat, Satistics } from '@antv/l7-utils';
import { hexbin } from 'd3-hexbin';
const R_EARTH = 6378000;
import {
IParseDataItem,
IParserData,
ISourceCFG,
ITransform,
} from '@antv/l7-core';
import { IParseDataItem, IParserData, ITransform } from '@antv/l7-core';
interface IHexBinItem<T> extends Array<T> {
x: number;
y: number;

View File

@ -2,11 +2,8 @@ import { ILayer, IMercator } from '@antv/l7-core';
import { BaseLayer } from '@antv/l7-layers';
import {
AnimationMixer,
Camera,
Matrix4,
Object3D,
PCFSoftShadowMap,
PerspectiveCamera,
Scene,
Vector3,
WebGLRenderer,

View File

@ -3,10 +3,8 @@ import { inject, injectable } from 'inversify';
import 'reflect-metadata';
import {
AnimationMixer,
Camera,
Matrix4,
PCFSoftShadowMap,
PerspectiveCamera,
Scene as ThreeScene,
WebGLRenderer,