Skip to content

Commit

Permalink
Forbid class fields to fix transpilation errors with Vite/ESBuild (#1…
Browse files Browse the repository at this point in the history
…2658)

* forbid class fields to fix transpilation errors with vite/esbuild

* fix flow
  • Loading branch information
mourner committed Apr 14, 2023
1 parent c76789e commit a090df0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"no-duplicate-imports": "off",
"import/no-duplicates": "error",

// prevent issues with esbuild/vite https://github.com/mapbox/mapbox-gl-js/issues/12656
"no-restricted-syntax": ["error", "ClassProperty[value]"],

// ensure compatibility with Node's native ESM
"import/extensions": ["error", {
"js": "always",
Expand Down
2 changes: 1 addition & 1 deletion src/style/style_layer/line_style_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import type {TilespaceQueryGeometry} from '../query_geometry.js';
import type {IVectorTileFeature} from '@mapbox/vector-tile';

class LineFloorwidthProperty extends DataDrivenProperty<number> {
useIntegerZoom = true;
useIntegerZoom: ?boolean;

possiblyEvaluate(value, parameters) {
parameters = new EvaluationParameters(Math.floor(parameters.zoom), {
Expand Down
3 changes: 2 additions & 1 deletion test/unit/util/util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ test('util', (t) => {
this.name = 'Tom';
}

ontimer = () => {
ontimer() {
t.equal(this.name, 'Tom');
t.end();
}
}

const my = new MyClass();
// $FlowFixMe[method-unbinding]
setTimeout(my.ontimer, 0);
});

Expand Down

0 comments on commit a090df0

Please sign in to comment.