Skip to content

Commit c545670

Browse files
committed
Forbid class fields to fix transpilation errors with Vite/ESBuild (#12658)
* forbid class fields to fix transpilation errors with vite/esbuild * fix flow
1 parent 9980ee9 commit c545670

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"no-duplicate-imports": "off",
2828
"import/no-duplicates": "error",
2929

30+
// prevent issues with esbuild/vite https://github.com/mapbox/mapbox-gl-js/issues/12656
31+
"no-restricted-syntax": ["error", "ClassProperty[value]"],
32+
3033
// ensure compatibility with Node's native ESM
3134
"import/extensions": ["error", {
3235
"js": "always",

src/style/style_layer/line_style_layer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import type {TilespaceQueryGeometry} from '../query_geometry.js';
2222
import type {IVectorTileFeature} from '@mapbox/vector-tile';
2323

2424
class LineFloorwidthProperty extends DataDrivenProperty<number> {
25-
useIntegerZoom = true;
25+
useIntegerZoom: ?boolean;
2626

2727
possiblyEvaluate(value, parameters) {
2828
parameters = new EvaluationParameters(Math.floor(parameters.zoom), {

test/unit/util/util.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ test('util', (t) => {
6969
this.name = 'Tom';
7070
}
7171

72-
ontimer = () => {
72+
ontimer() {
7373
t.equal(this.name, 'Tom');
7474
t.end();
7575
}
7676
}
7777

7878
const my = new MyClass();
79+
// $FlowFixMe[method-unbinding]
7980
setTimeout(my.ontimer, 0);
8081
});
8182

0 commit comments

Comments
 (0)