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 global.d.ts
jest.config.js jest.config.js
.eslintrc.* .eslintrc.*
packages/utils/src/mini-adapter/

View File

@ -15,8 +15,9 @@ module.exports = {
ecmaVersion: 12, ecmaVersion: 12,
sourceType: 'module' sourceType: 'module'
}, },
plugins: ['@typescript-eslint'], plugins: ['@typescript-eslint',"unused-imports"],
rules: { rules: {
"unused-imports/no-unused-imports": "error",
'@typescript-eslint/no-loss-of-precision':0, '@typescript-eslint/no-loss-of-precision':0,
'@typescript-eslint/no-inferrable-types': 0, '@typescript-eslint/no-inferrable-types': 0,
'no-constant-condition': 0, 'no-constant-condition': 0,
@ -38,5 +39,5 @@ module.exports = {
alwaysTryTypes: true, 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 { GaodeMap } from '@antv/l7-maps';
import React, { useEffect } from 'react'; 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 { GaodeMap } from '@antv/l7-maps';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
@ -60,21 +60,21 @@ export default () => {
'#2EA9A1', '#2EA9A1',
'#206C7C', '#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.on('loaded', () => {
scene.addLayer(layer); scene.addLayer(layer);
}) });
}, []) }, []);
return ( return (
<div <div
id="map" id="map"
style={{ style={{
height: '500px', 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 { GaodeMap } from '@antv/l7-maps';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';

View File

@ -83,9 +83,8 @@
"enzyme-adapter-react-16": "^1.5.0", "enzyme-adapter-react-16": "^1.5.0",
"enzyme-to-json": "^3.0.0-beta6", "enzyme-to-json": "^3.0.0-beta6",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-config-egg": "^7.5.1",
"eslint-plugin-html": "^6.0.0", "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", "father": "^4.0.0-rc.2",
"gatsby": "2.32.13", "gatsby": "2.32.13",
"gatsby-plugin-google-analytics": "^2.1.27", "gatsby-plugin-google-analytics": "^2.1.27",
@ -166,6 +165,7 @@
"postbuild": "yarn build:declarations", "postbuild": "yarn build:declarations",
"build:declarations": "lerna run tsc --stream --no-bail", "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: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:examples": "eslint packages/site/examples --fix --ext .js",
"lint:css": "stylelint 'packages/**/src/**/*.js{,x}'", "lint:css": "stylelint 'packages/**/src/**/*.js{,x}'",
"lint": "run-p -c lint:*", "lint": "run-p -c lint:*",
@ -197,7 +197,7 @@
], ],
"husky": { "husky": {
"hooks": { "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" "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 { DOM } from '@antv/l7-utils';
import Control, { PositionType } from './BaseControl'; 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) { export function getAngle(angle: number | undefined) {
if (angle === undefined) { if (angle === undefined) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,6 @@ import {
IGlobalConfigService, IGlobalConfigService,
ILayer, ILayer,
ILayerPlugin, ILayerPlugin,
ILngLat,
IMapService, IMapService,
IParseDataItem, IParseDataItem,
IStyleAttribute, IStyleAttribute,
@ -13,7 +12,7 @@ import {
TYPES, TYPES,
} from '@antv/l7-core'; } from '@antv/l7-core';
import { Version } from '@antv/l7-maps'; 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 { inject, injectable } from 'inversify';
import { cloneDeep } from 'lodash'; import { cloneDeep } from 'lodash';
import 'reflect-metadata'; import 'reflect-metadata';

View File

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

View File

@ -13,7 +13,7 @@ import {
TYPES, TYPES,
} from '@antv/l7-core'; } from '@antv/l7-core';
import { IParseDataItem } from '@antv/l7-source'; 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 d3interpolate from 'd3-interpolate';
import * as d3 from 'd3-scale'; import * as d3 from 'd3-scale';
import { inject, injectable } from 'inversify'; 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 { injectable } from 'inversify';
import 'reflect-metadata'; 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 { injectable } from 'inversify';
import 'reflect-metadata'; import 'reflect-metadata';
/** /**

View File

@ -1,16 +1,4 @@
import { import { gl, IModelUniform, ITexture2D } from '@antv/l7-core';
AttributeType,
gl,
IEncodeFeature,
ILayer,
ILayerPlugin,
IModelUniform,
IRasterParserDataItem,
IStyleAttributeService,
ITexture2D,
lazyInject,
TYPES,
} from '@antv/l7-core';
import { generateColorRamp, IColorRamp } from '@antv/l7-utils'; import { generateColorRamp, IColorRamp } from '@antv/l7-utils';
import BaseLayer from '../core/BaseLayer'; 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'; import BaseTileLayer from './tileLayer/baseTileLayer';
export class TMSTileLayer extends 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 = { export const BlendTypes: IBlendTypes = {
[BlendType.additive]: { [BlendType.additive]: {
enable: true, enable: true,

View File

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

View File

@ -1,12 +1,4 @@
import { import { ILayer, IPass, IPostProcessingPass } from '@antv/l7-core';
IGlobalConfigService,
ILayer,
ILayerPlugin,
IPass,
IPostProcessingPass,
IRendererService,
TYPES,
} from '@antv/l7-core';
/** /**
* 'blurH' -> ['blurH', {}] * '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'; import { vec2 } from 'gl-matrix';
export function computeMiter( export function computeMiter(
tangent: vec2, tangent: vec2,

View File

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

View File

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

View File

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

View File

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

View File

@ -16,11 +16,10 @@ import {
IStatusOptions, IStatusOptions,
IViewport, IViewport,
MapServiceEvent, MapServiceEvent,
MapStyle,
TYPES, TYPES,
} from '@antv/l7-core'; } from '@antv/l7-core';
import { DOM } from '@antv/l7-utils'; 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 { inject, injectable } from 'inversify';
import 'reflect-metadata'; import 'reflect-metadata';
import { IAMapEvent, IAMapInstance } from '../../typings/index'; import { IAMapEvent, IAMapInstance } from '../../typings/index';

View File

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

View File

@ -18,9 +18,9 @@ import {
TYPES, TYPES,
} from '@antv/l7-core'; } from '@antv/l7-core';
import { DOM } from '@antv/l7-utils'; 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 { inject, injectable } from 'inversify';
import mapboxgl, { IControl, Map } from 'mapbox-gl'; import mapboxgl, { Map } from 'mapbox-gl';
// tslint:disable-next-line:no-submodule-imports // tslint:disable-next-line:no-submodule-imports
import 'mapbox-gl/dist/mapbox-gl.css'; import 'mapbox-gl/dist/mapbox-gl.css';
import 'reflect-metadata'; import 'reflect-metadata';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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