Add precommit check (#1080)

Keeps the repo clean, same as several other of our repos

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Yuri Astrakhan
2025-02-25 05:01:15 -05:00
committed by GitHub
parent c58191ff62
commit 9540686b40
77 changed files with 143 additions and 177 deletions

View File

@@ -102,4 +102,3 @@ export default class Block extends React.Component<BlockProps, BlockState> {
</label>
}
}

View File

@@ -31,4 +31,3 @@ export default class Collapse extends React.Component<CollapseProps> {
}
}
}

View File

@@ -16,4 +16,3 @@ export default class Collapser extends React.Component<CollapserProps> {
return this.props.isCollapsed ? <MdArrowDropUp style={iconStyle}/> : <MdArrowDropDown style={iconStyle} />
}
}

View File

@@ -16,4 +16,3 @@ export default class FieldArray extends React.Component<FieldArrayProps> {
</Fieldset>
}
}

View File

@@ -15,4 +15,3 @@ export default class FieldAutocomplete extends React.Component<FieldAutocomplete
</Block>
}
}

View File

@@ -15,4 +15,3 @@ export default class FieldCheckbox extends React.Component<FieldCheckboxProps> {
</Block>
}
}

View File

@@ -18,4 +18,3 @@ export default class FieldColor extends React.Component<FieldColorProps> {
</Block>
}
}

View File

@@ -13,4 +13,3 @@ export default class FieldDynamicArray extends React.Component<FieldDynamicArray
</Fieldset>
}
}

View File

@@ -3,7 +3,7 @@ import InputEnum, {InputEnumProps} from './InputEnum'
import Fieldset from './Fieldset';
type FieldEnumProps = InputEnumProps & {
type FieldEnumProps = InputEnumProps & {
label?: string;
fieldSpec?: {
doc: string
@@ -17,4 +17,4 @@ export default class FieldEnum extends React.Component<FieldEnumProps> {
<InputEnum {...this.props} />
</Fieldset>
}
}
}

View File

@@ -404,4 +404,3 @@ export default class FieldFunction extends React.Component<FieldFunctionProps, F
</div>
}
}

View File

@@ -10,4 +10,3 @@ export default class FieldJson extends React.Component<FieldJsonProps> {
return <InputJson {...this.props} />
}
}

View File

@@ -15,4 +15,3 @@ export default class FieldMultiInput extends React.Component<FieldMultiInputProp
</Fieldset>
}
}

View File

@@ -18,5 +18,3 @@ export default class FieldSelect extends React.Component<FieldSelectProps> {
</Block>
}
}

View File

@@ -22,8 +22,8 @@ class FieldSourceLayerInternal extends React.Component<FieldSourceLayerInternalP
render() {
const t = this.props.t;
return <Block
label={t("Source Layer")}
return <Block
label={t("Source Layer")}
fieldSpec={latest.layer['source-layer']}
data-wd-key="layer-source-layer"
error={this.props.error}

View File

@@ -20,4 +20,3 @@ export default class FieldUrl extends React.Component<FieldUrlProps> {
);
}
}

View File

@@ -255,8 +255,8 @@ class FilterEditorInternal extends React.Component<FilterEditorInternalProps, Fi
value={combiningOp}
onChange={(v: [string, any]) => this.onFilterPartChanged(0, v)}
options={[
["all", t("every filter matches")],
["none", t("no filter matches")],
["all", t("every filter matches")],
["none", t("no filter matches")],
["any", t("any filter matches")]
]}
/>

View File

@@ -11,5 +11,3 @@ export default class IconBackground extends React.Component {
)
}
}

View File

@@ -11,5 +11,3 @@ export default class IconCircle extends React.Component {
)
}
}

View File

@@ -11,5 +11,3 @@ export default class IconFill extends React.Component {
)
}
}

View File

@@ -30,4 +30,3 @@ export default class IconLayer extends React.Component<IconLayerProps> {
}
}
}

View File

@@ -11,5 +11,3 @@ export default class IconLine extends React.Component {
)
}
}

View File

@@ -13,6 +13,3 @@ export default class IconSymbol extends React.Component {
)
}
}

View File

@@ -115,4 +115,3 @@ export default class FieldArray extends React.Component<FieldArrayProps, FieldAr
)
}
}

View File

@@ -98,5 +98,3 @@ export default class InputAutocomplete extends React.Component<InputAutocomplete
</div>
}
}

View File

@@ -30,4 +30,4 @@ export default class InputButton extends React.Component<InputButtonProps> {
{this.props.children}
</button>
}
}
}

View File

@@ -34,4 +34,4 @@ export default class InputCheckbox extends React.Component<InputCheckboxProps> {
</div>
</div>
}
}
}

View File

@@ -133,4 +133,3 @@ export default class InputColor extends React.Component<InputColorProps> {
</div>
}
}

View File

@@ -22,7 +22,7 @@ export type FieldDynamicArrayProps = {
}
'aria-label'?: string
label: string
}
}
type FieldDynamicArrayInternalProps = FieldDynamicArrayProps & WithTranslation;
@@ -67,7 +67,7 @@ class FieldDynamicArrayInternal extends React.Component<FieldDynamicArrayInterna
const t = this.props.t;
const i18nProps = { t, i18n: this.props.i18n, tReady: this.props.tReady };
const inputs = this.values.map((v, i) => {
const deleteValueBtn= <DeleteValueInputButton
const deleteValueBtn= <DeleteValueInputButton
onClick={this.deleteValue.bind(this, i)}
{...i18nProps}
/>;
@@ -152,4 +152,3 @@ class DeleteValueInputButton extends React.Component<DeleteValueInputButtonProps
</InputButton>
}
}

View File

@@ -47,4 +47,3 @@ export default class InputEnum extends React.Component<InputEnumProps> {
}
}
}

View File

@@ -37,5 +37,3 @@ export default class InputMultiInput extends React.Component<InputMultiInputProp
</fieldset>
}
}

View File

@@ -157,7 +157,7 @@ export default class InputNumber extends React.Component<InputNumberProps, Input
render() {
if(
Object.prototype.hasOwnProperty.call(this.props, "min") &&
Object.prototype.hasOwnProperty.call(this.props, "min") &&
Object.prototype.hasOwnProperty.call(this.props, "max") &&
this.props.min !== undefined && this.props.max !== undefined &&
this.props.allowRange
@@ -244,5 +244,3 @@ export default class InputNumber extends React.Component<InputNumberProps, Input
}
}
}

View File

@@ -30,5 +30,3 @@ export default class InputSelect extends React.Component<InputSelectProps> {
</select>
}
}

View File

@@ -97,5 +97,3 @@ export default class InputString extends React.Component<InputStringProps, Input
});
}
}

View File

@@ -326,10 +326,10 @@ class LayerEditorInternal extends React.Component<LayerEditorInternalProps, Laye
onSelection={handleSelection}
closeOnSelection={false}
>
<Button
id="skip-target-layer-editor"
data-wd-key="skip-target-layer-editor"
className='more-menu__button'
<Button
id="skip-target-layer-editor"
data-wd-key="skip-target-layer-editor"
className='more-menu__button'
title={"Layer options"}>
<MdMoreVert className="more-menu__button__svg" />
</Button>

View File

@@ -287,9 +287,9 @@ class LayerListContainerInternal extends React.Component<LayerListContainerInter
data-wd-key="skip-target-layer-list"
onClick={this.toggleLayers}
className="maputnik-button">
{this.state.areAllGroupsExpanded === true ?
t("Collapse")
:
{this.state.areAllGroupsExpanded === true ?
t("Collapse")
:
t("Expand")
}
</button>

View File

@@ -134,7 +134,7 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
this.state.inspect!.render();
}, 500);
}
}
componentDidMount() {

View File

@@ -27,7 +27,7 @@ class ModalLoadingInternal extends React.Component<ModalLoadingInternalProps> {
underlayClickExits={false}
underlayProps={{
// @ts-ignore
onClick: (e: Event) => underlayProps(e)
onClick: (e: Event) => underlayProps(e)
}}
title={this.props.title}
onOpenToggle={() => this.props.onCancel()}

View File

@@ -56,8 +56,8 @@ export default class PropertyGroup extends React.Component<PropertyGroupProps> {
const paint = this.props.layer.paint || {}
const layout = this.props.layer.layout || {}
const fieldValue = fieldName in paint
? paint[fieldName as keyof typeof paint]
const fieldValue = fieldName in paint
? paint[fieldName as keyof typeof paint]
: layout[fieldName as keyof typeof layout]
const fieldType = fieldName in paint ? 'paint' : 'layout';

View File

@@ -11,4 +11,3 @@ export default class ScrollContainer extends React.Component<ScrollContainerProp
</div>
}
}

View File

@@ -90,4 +90,3 @@ export default class SingleFilterEditor extends React.Component<SingleFilterEdit
</div>
}
}

View File

@@ -44,4 +44,3 @@ export default class SpecField extends React.Component<SpecFieldProps> {
</TypeBlock>
}
}

View File

@@ -91,7 +91,7 @@ class ExpressionPropertyInternal extends React.Component<ExpressionPropertyInter
function getValue(data: any) {
return stringifyPretty(data, {indent: 2, maxLength: 38})
}
if (jsonError) {
foundErrors.push({message: "Invalid JSON"});
}

View File

@@ -29,8 +29,8 @@ export default class SpecProperty extends React.Component<SpecPropertyProps> {
const functionBtn = <FunctionButtons
fieldSpec={this.props.fieldSpec}
onZoomClick={this.props.onZoomClick}
onDataClick={this.props.onDataClick}
onExpressionClick={this.props.onExpressionClick}
onDataClick={this.props.onDataClick}
onExpressionClick={this.props.onExpressionClick}
/>
const error = errors![fieldType+"."+fieldName as any] as any;

View File

@@ -31,7 +31,7 @@ function tryToParse(text: string) {
last_line: parseInt(errorMatch[1], 10),
last_column: parseInt(errorMatch[2], 10)
};
// const loc = hash.loc;
found.push({
from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
@@ -49,7 +49,7 @@ CodeMirror.registerHelper("lint", "json", (text: string) => {
});
CodeMirror.registerHelper("lint", "mgl", (text: string, opts: any, doc: any) => {
const found: MarkerRangeWithMessage[] = tryToParse(text);
const {context} = opts;

View File

@@ -11,4 +11,4 @@ export function undoMessages(beforeStyle: StyleSpecification, afterStyle: StyleS
}
export function redoMessages(beforeStyle: StyleSpecification, afterStyle: StyleSpecification) {
return diffMessages(beforeStyle, afterStyle).map(m => 'Redo ' + m)
}
}

View File

@@ -24,4 +24,3 @@ export function changeSource(mapStyle: StyleSpecification, sourceId: string, sou
sources: changedSources
}
}

View File

@@ -14,10 +14,10 @@ export default class ZoomControl {
this._container.setAttribute("data-wd-key", "maplibre:ctrl-zoom");
this.setLabel("Zoom:");
this.addEventListeners();
return this._container;
}
updateZoomLevel() {
this._textEl!.innerHTML = this._map!.getZoom().toFixed(2);
}
@@ -29,7 +29,7 @@ export default class ZoomControl {
this._textEl = this._container!.querySelector("span");
this.updateZoomLevel();
}
addEventListeners (){
this._map!.on('render', () => this.updateZoomLevel());
this._map!.on('zoomIn', () => this.updateZoomLevel());

View File

@@ -46,16 +46,14 @@ The following users can help you with the relevant languages:
| ISO Code | Language | User |
|----------|--------------------|--------------------------------------------|
| de | German | [@josxha](https://github.com/josxha) |
| en | English | [@HarelM](https://github.com/HarelM) |
| fr | French | [@lhapaipai](https://github.com/lhapaipai) |
| hr | Hebrew | [@HarelM](https://github.com/HarelM) |
| de | German | [@josxha](https://github.com/josxha) |
| en | English | [@HarelM](https://github.com/HarelM) |
| fr | French | [@lhapaipai](https://github.com/lhapaipai) |
| hr | Hebrew | [@HarelM](https://github.com/HarelM) |
| it | Italian | [@napo](https://github.com/napo) |
| ja | Japanese | [@keichan34](https://github.com/keichan34) |
| zh | Simplified Chinese | [@jieme](https://github.com/jieme) |
| ja | Japanese | [@keichan34](https://github.com/keichan34) |
| zh | Simplified Chinese | [@jieme](https://github.com/jieme) |
You can test the UI in different languages using the dropdown in the top menu
Note that Maputnik automatically localize based on browser language settings and stores this language in local storage.
You can use incognito mode to check a first time usage.

View File

@@ -88,4 +88,3 @@
.maplibregl-ctrl-map {
background-image: url('data:image/svg+xml;charset=utf8,<svg%20xmlns="http://www.w3.org/2000/svg"%20fill="#8e8e8e%22%20viewBox=%22-10%20-10%2060%2060%22%20preserveAspectRatio=%22xMidYMid%20meet%22%3E%3Cg%3E%3Cpath%20d=%22m25%2031.640000000000004v-19.766666666666673l-10-3.511666666666663v19.766666666666666z%20m9.140000000000008-26.640000000000004q0.8599999999999923%200%200.8599999999999923%200.8600000000000003v25.156666666666666q0%200.625-0.625%200.783333333333335l-9.375%203.1999999999999993-10-3.5133333333333354-8.906666666666668%203.4383333333333326-0.2333333333333334%200.07833333333333314q-0.8616666666666664%200-0.8616666666666664-0.8599999999999994v-25.156666666666663q0-0.625%200.6233333333333331-0.7833333333333332l9.378333333333334-3.198333333333334%2010%203.5133333333333336%208.905000000000001-3.4383333333333344z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E');
}

View File

@@ -71,7 +71,7 @@
}
to {
opacity: 0;
}
}
}
.JSONEditor__message {

View File

@@ -308,4 +308,3 @@
color: currentColor;
cursor: pointer;
}

View File

@@ -229,7 +229,7 @@
}
&:hover {
background-color: vars.$color-gray;

View File

@@ -323,4 +323,3 @@
margin-left: 4px;
}
}

View File

@@ -13,8 +13,8 @@ b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
@@ -25,7 +25,7 @@ time, mark, audio, video {
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}

View File

@@ -12,7 +12,7 @@
padding-left: 2px;
padding-right: 2px;
}
// Styling for Firefox
scrollbar-width: thin;
scrollbar-color: #666 #26282e;

View File

@@ -154,4 +154,3 @@
border-color: vars.$color-lowgray;
}
}

View File

@@ -155,4 +155,3 @@
overflow: hidden;
}
}