Skip to content

Commit

Permalink
Migrate to typescript (maplibre#209)
Browse files Browse the repository at this point in the history
* Update README.md

* Initial commit - only rename and flow to typescript conversion

* Iint upgrade

* More lint fixes

* Updated lint command, added build typescript command

* Add non typed modules according to ts fork.

* Switch from yarn to npm

* Fix hasOwnProperty lint errors
See https://eslint.org/docs/rules/no-prototype-builtins
* I used this command for the conversions:
* sed -i -E "s/([\(\!])([]/[a-zA-Z_.-]*).hasOwnProperty\(/
\1Object.prototype.hasOwnProperty.call(\2, /g" <file-name>

* Fix extension from .js to .ts

* Remove types file

* Ignore lint errors

* Remove .ts extension in import

* Update CI from node v10 to v14

* Replace yarn with npm

* Remove circleci

* Fixed some typings errors

* Explicitly convert matrix-gl types

* Automatically fix lint errors

* Avoid Function as callback type

* Add missing MapOptions

* Add pitchWithRotate to MapOptions and pass explicit options to HandlerManager and Camera

* Set type of MapOptions.style to StyleSpecification of string

* Make Camera an abstract class

* Use Float32Array instead of Float64Array and cast types

* Make object dynamically extendable
See https://stackoverflow.com/questions/12710905/how-do-i-dynamically-assign-properties-to-an-object-in-typescript

* Make more objects dynamically extenable

* Explicit cast of array to length 2

* Do not provide type any in for..in loop

* Make more objects dynamically extenable

* Cast layout.get return value to Number

* Cast number | void to number

* Specify Rect type

* Make thhird argument of getKey optional

* Cast number | void to number

* Define return type of parse() in subclasses of Expression

* Cast return type of context.error() from void to null

* Cast style-spec types to Type

* Cast return type of context.error() from void to null

* Cast style-spec types to Type

* Cast dict to StylePropertySpecification

* Specify array type as any to fix string[] inference

* Make third argument of coalesce() optional

* Explicit casts to Evaluate, Varargs, and Signature

* Revert "Cast style-spec types to Type"

This reverts commit 4af74a6.

* Revert "Cast style-spec types to Type"

This reverts commit efc4b1f.

* Cast style-spec types at their source

* Typescript: Remove @mapbox/geojson-types and replace with @types/GeoJSON' (maplibre#221)

* remove @mapbox/geojson-types and replace with @types/GeoJSON

* update toJSON using spread operator

* add type to import GLSL as strings (maplibre#222)

* Typescript: Use library to handle Window type (maplibre#223)

* add window type lib

* remove internal window type file and use lib

* Fix issues related to possibly evaluated design

* Move IControl interface to a new class, Fix timeoutID type.

* remove flow-typed folder (maplibre#225)

* Typescript: Remove reference to @mapbox/point-geometry TBC (maplibre#226)

* Remove reference to @mapbox/point-geometry and replace with local point module with types
Remove commented out types
Fix cannot find type Point errors
Add static to fix convert does not exist on typeof Point errors

* Remove @mapbox/point-geometry from packkage.json

* Fix lint

* Typescript: fix lint and update .eslintrc with alternate TS rule (maplibre#227)

* fix lint and .eslintrc with alternate TS rule

* remove comment

* Typescript: a number of minor fixes from WIP branch (maplibre#228)

* fix minor ID type issues

* minor casting fix non bool to bool

* fix thrown Error message issue

* fix a couple of import issues

* match date comparison types

* remove commented out code

* fixes from WIP branch

* remove redundant import for lint

* more fixes

* Fix small typings issues

* More typescript fixes

* More fixes to typings, lint fixes

* Change base calls to be abstract

* More type fixes

* More types fixes

* More types fixes

* update use of mat4 (maplibre#219)

updating types as gl-matrix
more types to gl-matrix
cleanup cast vs constructor
cleanup more gl-matrix types
more using gl-matrix instead of Float32Array
fixes from WIP squashed into one commit
minor cleanup and comments

* Added some "as any" to places in the code where the typing were not just right and the method are proplemeatic...

* More types fixing, not perfect but good enough.

* Fix last typescript errors

* Fix incorrect typings and code errors.

* Remove flow from rollup and add tsc to build

* Format file

* Fix rollup build

* Initial commit to make the render test run

* Remove unneeded window import from all files

* Remove version from API

* More mock fixes to be able to run tests

* fix running of test-expression (maplibre#232)

* Add build phase before running some of the tests

* Fix tests get stuck, still tests are failing...

* get node query tests running (maplibre#233)

* Fix mocking of case of tilejson implementation.

* Typescript: Fix unit-tests (maplibre#235)

* Move all referneces in unit test to use the build output

* Fixes to window related stuff in unit tests, fixes to unneeded requires.

* Fix to dem data test

* Fix tests - remove window restore, fix __dirname.

* Fix stub_loader due to function this usage.

* Fix more tests

* Fix tests and code that causes tests to fail.

* Fix usage of ajax.js by subbing it correctly

* Added missing window element to tests

* removing window in 2 places gains 1601 passing (maplibre#236)

* Adding missing windows to tests

* Fix tests, revert some changes from typescript migration

* More fixes related to removal of window

* remove warnings, fix attribution test

* Fix more tests

* Fix more tests

* Added missing stubs

* Fixed tests related to version removal

* More test fixes related to file path

* Typescript: unit tests Frustum issues (maplibre#238)

* fix minor file errors in stub_loader.js

* matrix tests pass but not sure the tests represent actual usage

* Fix primitive tests with minimal usage of "bad" types

* Minor fixes to reduce incorrect typings

* Fix image load for image source and style tests

* Fix tests, added missing stub_loader

* Fix uuid incorrect implemetation

* Fix ajax tests. imporved image mock

* Fix camera tests

* Revert changes related to incorrect typescript solution

Co-authored-by: James Hamilton <chippieTV@users.noreply.github.com>

* Incorrect invocation of build-dev...

* Fix lint errors

* Removed test flow

* Fix build csp, started to fix style build

* Fix css build

* Remove to vec3 as to code review requirements

* Remove flow from build in ci

* Remove references to @mapbox/point-geometry

* Allow building style-spec

* Fix build tests

* Remove window, fix missing references to FeatureIndex using typescript config, update rollup dependencies

* Fix lint

* Fix production build

* Remove buble, stop compiling for es5

* Added missing global definitions after removing window

* Fix tests, bring back web_worker mock file, fix maplibre-gl loading issue, revert tsconfig.

* Fix build?

* Fix lint

* Typescript: Fix query-tests (maplibre#240)

* Initial commit to fix query-tests

* Fix query tests

* Fix some lint issues

* Typescript: minor fixes to formatting (maplibre#241)

* minor fixes

* fix formatting of object key value types

* Remove unneeded comments

* Fix according to code review

* Remove undefined as any

* Fix according to code review requirements.

* Fix lint

* More lint cover and fixes

* Fix lint for windows, update versions.

* Fix browser tests due to incorrect lint fix

* Fix lint for land.html

* Fix minimal node version to 14

* Typescript: merge from main (maplibre#243)

* Highlight backport rules

* Add backport rules

* Add backport rules

* Use organization secret NPM_ORG_TOKEN (maplibre#231)

* Fix link in README and CONTRIBUTING. Fix typo in README. (maplibre#237)

* one yarn forgotten (maplibre#242)

Co-authored-by: Marcel Normann <marcel.normann@wheregroup.com>
Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>
Co-authored-by: tunnelpuzzle <79618312+tunnelpuzzle@users.noreply.github.com>

* Update Life of a tile docs (maplibre#247)

* rename .js to .ts in doc/life-of-a-tile.md

* Update Developer Doc - Life of a tile (maplibre#245)

* life of a tile

* correction

* Update package.json (maplibre#248)

* rename .js to .ts in doc/life-of-a-tile.md

* life of a tile

* correction

* package.json

* some updates from review (maplibre#252)

* Fix WritingMode cast (maplibre#254)

* Run CI on all pull requests (maplibre#255)

* Remove redundant parentheses (maplibre#257)

* Remove (minify = false)

* Review cleanup (maplibre#259)

* Remove redundant parentheses

* Remove eslint typescript exceptions

* Remove flow comments

* Remove `Number()` casts

* Remove parentheses

* Remove commented lint plugin

* Remove `HM TODO` comments

* Remove TODO, Fix according to code review changes

* Remove last TODOs.

* Updated changelog

* Change publish style spec to reflect latest changes in typescript

* Fix code review comments

* Declare `emplace()` with variable number of arguments (maplibre#262)

* Fix comment of generated files

* Fix according to code review

* remove comment and update type in jsdoc (maplibre#269)

* Copy dist folder with `cp -r` (maplibre#274)

* Fix typo

* Fix last comments about generated files.

* Fix typos in comments (maplibre#283)

* Remove polyfill support for IE11 (maplibre#284)

* Use native endsWith function

* Use native Object.values function

* Use native Number.MAX_SAFE_INTEGER value

* Fix typos, remove unused functions

The functions are already defined in `src/util/mapbox.ts`

* Enforce semicolons as member delimters (maplibre#282)

* eslint - enforce single quotes (maplibre#285)

Turn on @typescript-eslint/quotes rule to standardize on single quotes for all strings.

* move point.ts from symbol/ to util/ (maplibre#287)

* move point.ts from symbol/ to util/

* Remove empty line

* Remove undefined as any casts (maplibre#292)

Unnecessary casts for 'undefined' or 'null' as 'any'.

* Remove feature detection for {passive: false} support (maplibre#291)

* Changed version in package.json before merge

* Remove the usage of devicePixelRatio as a getter from browser.ts (maplibre#294)

Co-authored-by: Oliver Wipfli <oliver.wipfli@leichteralsluft.ch>
Co-authored-by: James Hamilton <chippieTV@users.noreply.github.com>
Co-authored-by: Astrid <astridx@users.noreply.github.com>
Co-authored-by: Marcel Normann <marcel.normann@wheregroup.com>
Co-authored-by: tunnelpuzzle <79618312+tunnelpuzzle@users.noreply.github.com>
Co-authored-by: Frédéric Junod <frederic.junod@camptocamp.com>
Co-authored-by: Derek Westcott <drwestco@gmail.com>
  • Loading branch information
8 people committed Sep 3, 2021
1 parent 49bc4ca commit e78ad79
Show file tree
Hide file tree
Showing 577 changed files with 29,025 additions and 22,550 deletions.
231 changes: 0 additions & 231 deletions .circleci/config.yml

This file was deleted.

34 changes: 20 additions & 14 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
{
"extends": [
"mourner",
"plugin:flowtype/recommended",
"plugin:import/recommended"
"plugin:import/recommended",
"plugin:import/typescript"
],
"parser": "babel-eslint",
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module"
"sourceType": "module",
"createDefaultProgram": true
},
"plugins": [
"flowtype",
"@typescript-eslint",
"import",
"jsdoc"
],
"rules": {
"no-dupe-class-members": "off",
"@typescript-eslint/no-dupe-class-members": ["error"],
"@typescript-eslint/no-unused-vars": [
"warn",
{ "argsIgnorePattern": "^_" }
],
"@typescript-eslint/member-delimiter-style": ["error"],
// Disable no-undef. It's covered by @typescript-eslint
"no-undef": "off",
// temporarily disabled due to https://github.com/babel/babel-eslint/issues/485
"no-use-before-define": "off",

Expand All @@ -33,13 +43,6 @@

"array-bracket-spacing": "off",
"consistent-return": "off",
"flowtype/define-flow-type": 1,
"flowtype/require-valid-file-annotation": [
2,
"always", {
"annotationStyle": "line"
}
],
"global-require": "off",
"import/no-commonjs": "error",
"key-spacing": "off",
Expand All @@ -50,13 +53,15 @@
"object": "Object",
"property": "assign"
}],
"no-unused-vars": ["error", {"argsIgnorePattern": "^_$"}],
"no-unused-vars": "off",
"no-warning-comments": "error",
"object-curly-spacing": ["error", "never"],
"prefer-arrow-callback": "error",
"prefer-const": ["error", {"destructuring": "all"}],
"prefer-template": "error",
// @typescript-eslint/quotes requires standard quotes rule to be turned off
"quotes": "off",
"@typescript-eslint/quotes": ["error", "single"],
"space-before-function-paren": "off",
"template-curly-spacing": "error",
"no-useless-escape": "off",
Expand All @@ -72,7 +77,7 @@
"parameters": "off"
}
}],
"no-multiple-empty-lines": [ "error", {
"no-multiple-empty-lines": [ "error", {
"max": 1
}],
"jsdoc/check-param-names": "warn",
Expand All @@ -87,6 +92,7 @@
"ignorePrivate": true
}
},
"ignorePatterns": ["build/*.js", "*.json"],
"overrides": [
{
"files": ["debug/**", "bench/**", "test/**", "src/style-spec/**"],
Expand Down
61 changes: 0 additions & 61 deletions .flowconfig

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
# report status back to pull request
- uses: haya14busa/action-workflow_run-status@v1
- uses: actions/checkout@v2
- name: Use Node.js 10 x64
- name: Use Node.js 14 x64
uses: actions/setup-node@v2-beta
with:
node-version: 10
node-version: 14
architecture: x64
- run: yarn install --frozen-lockfile
- run: npm ci
- name: Download branch artifact
uses: dawidd6/action-download-artifact@v2
with:
Expand Down
Loading

0 comments on commit e78ad79

Please sign in to comment.