Skip to content

Commit

Permalink
Merge pull request #71 from geostyler/add-prettier
Browse files Browse the repository at this point in the history
fix: add prettier
  • Loading branch information
ger-benjamin authored Nov 4, 2024
2 parents 8cd7222 + a88b888 commit 6bb1f11
Show file tree
Hide file tree
Showing 42 changed files with 757 additions and 615 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
module.exports = {
extends: '@terrestris/eslint-config-typescript',
extends: [
'@terrestris/eslint-config-typescript',
'prettier'
],
rules: {
'no-underscore-dangle': 'off',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': ['error'],
camelcase: [
Expand Down
7 changes: 7 additions & 0 deletions .idea/prettier.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Geostyler Style Parser for ArcGIS Pro layer file format `.lyrx`

This is **pre-alpha version**, without correct type, and no test. Be careful.

This project is originally based on the GeoCat/bridge-style (MIT license).
This project is originally based on the GeoCat/bridge-style (MIT license).
29 changes: 29 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"scripts": {
"build": "babel src -d dist --source-maps --extensions '.ts' && tsc --declaration",
"typecheck": " tsc --project tsconfig-typecheck.json",
"lint": "eslint -c .eslintrc.cjs src/**/*.ts",
"lint": "eslint -c .eslintrc.cjs src/**/*.ts && npm run prettier:check",
"prettier:check": "prettier src --write",
"prettier": "prettier src --write",
"prepublishOnly": "npm run build",
"release": "np --no-yarn",
"test": "vitest",
Expand All @@ -50,6 +52,8 @@
"conventional-changelog-conventionalcommits": "^8.0.0",
"coveralls": "^3.1.1",
"eslint": "^8.40.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.3.3",
"typescript": "^5.4.5",
"vitest": "^2.0.0"
},
Expand Down
10 changes: 5 additions & 5 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
export const ESRI_SYMBOLS_FONT: string = 'ESRI Default Marker';
export const ESRI_SYMBOLS_FONT: string = "ESRI Default Marker";
export const POLYGON_FILL_RESIZE_FACTOR: number = 2 / 3;
export const OFFSET_FACTOR: number = 4 / 3;

export enum MarkerPlacementPosition {
START = 'startPoint',
END = 'endPoint'
START = "startPoint",
END = "endPoint",
}

export enum MarkerPlacementAngle {
START = 'startAngle',
END = 'endAngle'
START = "startAngle",
END = "endAngle",
}

export const ptToPx = (pt: number): number => {
Expand Down
5 changes: 1 addition & 4 deletions src/esri/types/CIMFeatureTable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@

export type CIMFeatureTable = {

};
export type CIMFeatureTable = {};
25 changes: 12 additions & 13 deletions src/esri/types/CIMLayerAction.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@

type CIMActivity = {};
type CIMCondition = {};

export type CIMLayerAction = {
/**
* Gets or sets the name.
*/
name?: null | string;
/**
* Gets or sets activities.
*/
activities?: CIMActivity[] | null;
/**
* Gets or sets conditions.
*/
conditions?: CIMCondition[] | null;
/**
* Gets or sets the name.
*/
name?: null | string;
/**
* Gets or sets activities.
*/
activities?: CIMActivity[] | null;
/**
* Gets or sets conditions.
*/
conditions?: CIMCondition[] | null;
};
7 changes: 3 additions & 4 deletions src/esri/types/CIMLayerDocument.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { CIMLayerDefinition } from './layers/CIMLayerDefinition.ts';

import { CIMLayerDefinition } from "./layers/CIMLayerDefinition.ts";

export type CIMLayerDocument = {
name: string;
layerDefinitions: CIMLayerDefinition[];
name: string;
layerDefinitions: CIMLayerDefinition[];
};
3 changes: 1 addition & 2 deletions src/esri/types/CIMObject.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

export type CIMObject = {
type: string;
type: string;
};
9 changes: 4 additions & 5 deletions src/esri/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

export * from './CIMLayerDocument.ts';
export * from './labeling/index.ts';
export * from './layers/index.ts';
export * from './renderers/index.ts';
export * from "./CIMLayerDocument.ts";
export * from "./labeling/index.ts";
export * from "./layers/index.ts";
export * from "./renderers/index.ts";
16 changes: 8 additions & 8 deletions src/esri/types/labeling/CIMLabelClass.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { CIMObject } from '../CIMObject.ts';
import { CIMMaplexLabelPlacementProperties } from './CIMMaplexLabelPlacementProperties.ts';
import { CIMStandardLabelPlacementProperties } from './CIMStandardLabelPlacementProperties.ts';
import { CIMSymbolReference } from './CIMSymbolReference.ts';
import { CIMObject } from "../CIMObject.ts";
import { CIMMaplexLabelPlacementProperties } from "./CIMMaplexLabelPlacementProperties.ts";
import { CIMStandardLabelPlacementProperties } from "./CIMStandardLabelPlacementProperties.ts";
import { CIMSymbolReference } from "./CIMSymbolReference.ts";

type FeaturesToLabel = {};

export enum LabelExpressionEngine {
VBScript = 'VBScript',
JScript = 'JScript',
Python = 'Python',
Arcade = 'Arcade',
VBScript = "VBScript",
JScript = "JScript",
Python = "Python",
Arcade = "Arcade",
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/esri/types/labeling/CIMMaplexLabelPlacementProperties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ export type CIMMaplexLabelPlacementProperties = CIMObject & {
* Gets or sets the unit of the inset value for perimeter polygon anchor points.
*/
polygonAnchorPointPerimeterInsetUnit?: MaplexUnit;
}
};
/**
* Represents the properties required for authoring an Arcade expression.
*/
Expand All @@ -536,7 +536,7 @@ export type CIMExpressionInfo = {
* Gets or sets the ReturnType of the expression.
*/
returnType?: ExpressionReturnType;
}
};
/**
* Represents Maplex label stacking properties.
*
Expand Down Expand Up @@ -566,7 +566,7 @@ export type CIMMaplexLabelStackingProperties = CIMObject & {
* Gets or sets a value indicating whether leading and trailing stacking separators are trimmed from the label string.
*/
trimStackingSeparators?: boolean;
}
};
/**
* Represents a Maplex stacking separator.
*
Expand Down
6 changes: 3 additions & 3 deletions src/esri/types/labeling/CIMMaplexRotationProperties.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CIMObject } from '../CIMObject.ts';
import { CIMObject } from "../CIMObject.ts";
import {
MaplexLabelRotationType,
MaplexRotationAlignmentType,
CIMExpressionInfo
} from './CIMMaplexLabelPlacementProperties.ts';
CIMExpressionInfo,
} from "./CIMMaplexLabelPlacementProperties.ts";

/**
* Represents Maplex rotation properties.
Expand Down
2 changes: 1 addition & 1 deletion src/esri/types/labeling/CIMMaplexStrategyPriorities.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CIMObject } from '../CIMObject.ts';
import { CIMObject } from "../CIMObject.ts";

/**
* Represents Maplex strategy priorities.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export type CIMStandardLabelPlacementProperties = CIMObject & {
* Gets or sets a value indicating whether or not to allow overlapping labels.
*/
allowOverlappingLabels?: boolean;
}
};
/**
* Represents standard label engine line label position.
*
Expand Down
85 changes: 42 additions & 43 deletions src/esri/types/labeling/CIMSymbolReference.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,54 @@
import { CIMSymbol } from '../symbols/index.ts';
import { CIMSymbol } from "../symbols/index.ts";

type CIMPrimitiveOverride = {};
type CIMScaleDependentSizeVariation = {};


export type Geometry = {
rings?: number[][][];
paths?: number[][][];
curveRings?: { a?: number[][]; c?: number[][] }[][];
rings?: number[][][];
paths?: number[][][];
curveRings?: { a?: number[][]; c?: number[][] }[][];
};

/**
* Represents a symbol reference.
*
*/
export type CIMSymbolReference = {
geometry: Geometry;
/**
* Gets or sets the primitive overrides. Typically set by renderers at draw time.
*/
primitiveOverrides?: CIMPrimitiveOverride[] | null;
/**
* Gets or sets the style path. Reserved for future use.
*/
stylePath?: null | string;
/**
* Gets or sets the symbol.
*/
symbol?: null | CIMSymbol;
/**
* Gets or sets the symbol name.
*/
symbolName?: null | string;
/**
* Gets or sets the minimum scale range the symbol reference should be displayed at.
*/
minScale?: number;
/**
* Gets or sets the maximum scale range the symbol reference should be displayed at.
*/
maxScale?: number;
/**
* Gets or sets an array of scale dependent sizes.
*/
scaleDependentSizeVariation?: CIMScaleDependentSizeVariation[] | null;
/**
* Gets or sets the minimum distance at which symbols are visible. Objects closer than this don't get rendered.
*/
minDistance?: number;
/**
* Gets or sets the maximum distance at which symbols are visible. Objects beyond this point don't get rendered.
*/
maxDistance?: number;
};
geometry: Geometry;
/**
* Gets or sets the primitive overrides. Typically set by renderers at draw time.
*/
primitiveOverrides?: CIMPrimitiveOverride[] | null;
/**
* Gets or sets the style path. Reserved for future use.
*/
stylePath?: null | string;
/**
* Gets or sets the symbol.
*/
symbol?: null | CIMSymbol;
/**
* Gets or sets the symbol name.
*/
symbolName?: null | string;
/**
* Gets or sets the minimum scale range the symbol reference should be displayed at.
*/
minScale?: number;
/**
* Gets or sets the maximum scale range the symbol reference should be displayed at.
*/
maxScale?: number;
/**
* Gets or sets an array of scale dependent sizes.
*/
scaleDependentSizeVariation?: CIMScaleDependentSizeVariation[] | null;
/**
* Gets or sets the minimum distance at which symbols are visible. Objects closer than this don't get rendered.
*/
minDistance?: number;
/**
* Gets or sets the maximum distance at which symbols are visible. Objects beyond this point don't get rendered.
*/
maxDistance?: number;
};
6 changes: 3 additions & 3 deletions src/esri/types/labeling/LabelFeatureType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export enum LabelFeatureType {
Point = 'Point' ,
Line = 'Line',
Polygon = 'Polygon'
Point = "Point",
Line = "Line",
Polygon = "Polygon",
}
6 changes: 3 additions & 3 deletions src/esri/types/labeling/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './CIMLabelClass.ts';
export * from './CIMSymbolReference.ts';
export * from './LabelFeatureType.ts';
export * from "./CIMLabelClass.ts";
export * from "./CIMSymbolReference.ts";
export * from "./LabelFeatureType.ts";
10 changes: 5 additions & 5 deletions src/esri/types/layers/CIMFeatureLayer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CIMLayerAction } from '../CIMLayerAction.ts';
import { CIMLayerDefinition } from './CIMLayerDefinition.ts';
import { CIMLabelClass } from '../labeling/CIMLabelClass.ts';
import { CIMSymbolReference } from '../labeling/CIMSymbolReference.ts';
import {CIMRenderer} from '../renderers';
import { CIMLayerAction } from "../CIMLayerAction.ts";
import { CIMLayerDefinition } from "./CIMLayerDefinition.ts";
import { CIMLabelClass } from "../labeling/CIMLabelClass.ts";
import { CIMSymbolReference } from "../labeling/CIMSymbolReference.ts";
import { CIMRenderer } from "../renderers";

type CIMDataConnection = {};
type CIMSymbolLayerMasking = {};
Expand Down
4 changes: 2 additions & 2 deletions src/esri/types/layers/CIMLayerDefinition.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CIMObject } from '../CIMObject.ts';
import { CIMObject } from "../CIMObject.ts";

export type CIMLayerDefinition = CIMObject & {
name: string;
name: string;
};
Loading

0 comments on commit 6bb1f11

Please sign in to comment.