Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: move Router fully to TypeScript #886

Merged
merged 121 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
7069a07
feat!: replace umd and esm bundles with esm for distribution
platosha May 22, 2023
fea6f12
chore: remove gen-typescript-declarations dependency
platosha May 23, 2023
97a3fca
build: separate tsconfig.json for build and test
platosha May 23, 2023
639d194
--wip-- [skip ci]
platosha May 24, 2023
f7d5a92
--wip-- [skip ci]
platosha May 26, 2023
f8a3905
--wip-- [skip ci]
platosha May 29, 2023
fb3d74e
--wip-- [skip ci]
platosha May 31, 2023
c8f9465
--wip-- [skip ci]
platosha May 31, 2023
7503d75
--wip-- [skip ci]
platosha Jun 1, 2023
ba6b546
--wip-- [skip ci]
platosha Jun 1, 2023
f7ff2fd
--wip-- [skip ci]
platosha Jun 2, 2023
873d41b
chore: remove interfaces.d.ts
platosha Jun 2, 2023
3c31295
test: add vite, karma, mocha devDeps
platosha Jun 2, 2023
5d04cbf
--wip-- [skip ci]
platosha Jun 7, 2023
61ef448
test: fix .nested.property assertions
platosha Jun 20, 2023
5049dbe
fix: match parent route when route.children is truthy
platosha Jun 20, 2023
792c997
refactor: improve types and move them to d.ts
Lodin Jun 21, 2023
8ee31e6
refactor: move generatedUrls spec to TS
Lodin Jun 21, 2023
3d222dd
refactor: move matchPath spec to TS
Lodin Jun 21, 2023
3b8753e
refactor: move dynamic-redirect spec to TS
Lodin Jun 21, 2023
39bd3c7
chore: update config files
Lodin Jun 21, 2023
eb61976
refactor: cleanup code & move to async-await to resolve the dynamic-r…
Lodin Jun 26, 2023
0d1d2b5
chore: improve Karma config
Lodin Jul 3, 2023
f5b01df
refactor: improve code & tests
Lodin Jul 3, 2023
65fa9e0
refactor: move code/tests to plain TS files
Lodin Jul 6, 2023
8bd42eb
test: fix most of the test issues
Lodin Jul 10, 2023
0410581
refactor: add some types to utils and to supplementary declaration file
Lodin Jul 11, 2023
e5de739
chore: update dependencies
Lodin Jul 11, 2023
831034e
test: disable several failing tests
Lodin Jul 11, 2023
b9f7f1b
refactor: redirect type import
Lodin Jul 11, 2023
5497207
refactor: add typings for generateUrls module
Lodin Jul 12, 2023
f1ef619
chore: add eslint-config-vaadin and perfectionist plugin
Lodin Jul 12, 2023
3e3ea99
refactor: make path not required
Lodin Jul 12, 2023
d76cba3
refactor: finalize matchPath & matchRoute functions
Lodin Jul 13, 2023
8036783
chore: get back Mocha reporter in Karma
Lodin Jul 13, 2023
44796c1
refactor: improve typings for Resolver
Lodin Jul 14, 2023
3b7f65b
refactor: improve typings for Resolver [2]
Lodin Aug 1, 2023
1abdc8b
build: update dependencies and remove install blockers
platosha Sep 12, 2024
c4d0eb4
build: add separate compile tsconfig
platosha Sep 12, 2024
fc2c9e1
fix: some TypeScript errors
platosha Sep 13, 2024
aea9c4b
refactor: update typings for the Router
Lodin Sep 20, 2024
1e9d8cd
chore: remove unnecessary import
platosha Sep 23, 2024
e5f4357
test: fix karma setup
platosha Sep 23, 2024
393ca42
refactor: improve typings & update some tests
Lodin Sep 23, 2024
c808fad
test: remove ShadyDOM suite marking
platosha Sep 24, 2024
3a18093
fix: matching routes with empty children
platosha Sep 24, 2024
6cabacb
test: remove test for { path: null } route
platosha Sep 24, 2024
8a2b418
test: relax asserting { done: false } iterator result to falsy
platosha Sep 24, 2024
fd81279
add github action validation file
ZheSun88 Sep 24, 2024
96c03c1
remove unnecessary travis file
ZheSun88 Sep 24, 2024
99fa152
fix: Resolver not found error handling
platosha Sep 24, 2024
99c111b
refactor: fix some typings & update tests
Lodin Sep 24, 2024
3552482
fix: restore resolver children behaviour
platosha Sep 24, 2024
ce64e69
test: enable lifecycle events test
platosha Sep 25, 2024
254aa6d
fix: Params array support
platosha Sep 25, 2024
e96c42d
refactor: restore context result type returned from resolve()
platosha Sep 25, 2024
ab6c28e
refactor: fix typings & update more tests
Lodin Sep 25, 2024
01c95b9
refactor: use RouteContext type in resolve callback argument
platosha Sep 25, 2024
fee253d
refactor: remove promise from onAfterEnter / onAfterLeave
platosha Sep 25, 2024
a1bb61a
fix: workflow around resolve next(), unwrap context result
platosha Sep 26, 2024
b838b53
test: use spec reporter with karma
platosha Sep 26, 2024
bf2ea88
test: avoid errorneous initial render from setRoutes
platosha Sep 26, 2024
5e86c93
test: fix TypeScript error in matchRoute suite
platosha Sep 27, 2024
746fc8d
test: adjust assertion for async setRoutes method
platosha Sep 27, 2024
2f45e8f
test: fix checkOutlet utility function
platosha Sep 27, 2024
002e0db
test: test suite structure
platosha Sep 27, 2024
541a5ec
fix: carry locaiton.redirectFrom from redirect context
platosha Sep 27, 2024
c3f7bbd
refactor: make Resolver typings more agnostic
Lodin Sep 26, 2024
6cfda24
test: address some ESlint feedback in tests
platosha Sep 27, 2024
cee60d5
test: address more ESlint feedback in tests
platosha Sep 27, 2024
d79e4bd
test: fix syntax
platosha Sep 27, 2024
65e6cd3
test: bypass TypeScript errors in some tests
platosha Sep 27, 2024
3ae0217
test: avoid errorneous initial render from setRoutes
platosha Sep 30, 2024
242d849
fix: support sync render() use cases
platosha Sep 30, 2024
3f80c24
fix: support params in getUrl()
platosha Sep 30, 2024
54656b0
chore: make render async again
platosha Sep 30, 2024
b815490
test: ensure consistent initial location in router tests
platosha Sep 30, 2024
8bfa5bb
refactor: address more TypeScript / ESLint feedback
platosha Sep 30, 2024
6508c4c
fix: runtime behaviour for primitive resolve results
platosha Oct 1, 2024
fee9bf1
fix: remove next from children context
platosha Oct 1, 2024
88a1c83
test: support route errors also from setRoutes
platosha Oct 1, 2024
676ad94
test: avoid deep.property assertions on Element
platosha Oct 1, 2024
f5f5ff3
test(resolver): resolver result is wrapped in context
platosha Oct 1, 2024
f3310fb
refactor: support more urlFor param types
platosha Oct 1, 2024
e074f67
fix: support using view component name in urlFor
platosha Oct 1, 2024
c2b6144
refactor: finalize Resolver
Lodin Oct 1, 2024
80cb979
refactor: restore ensureRoute / ensureRoutes / fireRouterEvent utils
platosha Oct 1, 2024
1c6a7e6
fix: support symbolic NotFoundResult
platosha Oct 1, 2024
63493c9
fix: router lifecycle use cases
platosha Oct 1, 2024
c76a042
test: more correct timing in simultanious callback tests
platosha Oct 2, 2024
e443db6
refactor: continue working on the Router typings
Lodin Oct 2, 2024
fc56884
refactor: almost finalize Router typings
Lodin Oct 2, 2024
a2ce3fe
fix: matching parameterized routes
platosha Oct 3, 2024
3f8a596
refactor: attempt to resolve the most stubborn types
Lodin Oct 3, 2024
acfccd2
refactor: address TypeScript / ESLint errors
platosha Oct 4, 2024
044f751
refactor: fix TypeScript type for action
platosha Oct 4, 2024
417317d
refactor: fix TypeScript type for action
platosha Oct 4, 2024
6d5bd18
refactor: improve typings
Lodin Oct 4, 2024
71cf1e1
fix: make `commands` in action required
Lodin Oct 4, 2024
9cf9d0b
fix: type for default resolveRoute implementation
platosha Oct 4, 2024
5cd06ef
test: make tests run again
platosha Oct 4, 2024
4c3daa8
test: use spy instead of stub for updated sinon API
platosha Oct 4, 2024
80b2102
fix: remove next from children context
platosha Oct 4, 2024
ec2f67e
refactor: continue moving to typescript in tests
Lodin Oct 4, 2024
b1f31ba
style: lint
Lodin Oct 4, 2024
d43da1b
style: format
Lodin Oct 4, 2024
766fea1
fix: prevent extra onBeforeLeave lifecycle callback calls
platosha Oct 4, 2024
09a6f27
refactor: rollback testing-library changes to avoid test breaks
Lodin Oct 5, 2024
7d98b63
refactor: small fixes
Lodin Oct 5, 2024
1b0ff53
refactor: use native private props in router
Lodin Oct 5, 2024
d11d6a5
refactor: fix TS errors
Lodin Oct 7, 2024
703647d
refactor: get back test search
Lodin Oct 7, 2024
e320716
fix: remove next from children context
platosha Oct 7, 2024
cfe7064
test: avoid erroneous parallel assertions
platosha Oct 7, 2024
57c9801
build: add TypeScript validation steps
platosha Oct 7, 2024
cb15b2d
test: fix error in TypeScript fixture
platosha Oct 7, 2024
f88fc5a
refactor: cleanup & deps update
platosha Oct 7, 2024
aed2ed0
build: add TypeScript declaration files
platosha Oct 7, 2024
9feb651
build: add TypeScript declaration files
platosha Oct 7, 2024
2d74179
refactor!: remove bower support
platosha Oct 7, 2024
4d021cb
refactor!: remove documentation-only interfaces
platosha Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 16 additions & 70 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,77 +1,23 @@
{
"extends": "eslint:recommended",
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": [
"html"
"extends": [
"vaadin/typescript-requiring-type-checking",
"vaadin/imports-typescript",
"vaadin/prettier",
"vaadin/testing",
"plugin:oxlint/recommended"
],
"globals": {
"Polymer": false,
"Vaadin": false
},
"parserOptions": {
"sourceType": "module"
"project": "./tsconfig.json"
},
"plugins": ["tsdoc"],
"rules": {
"curly": 2,
"no-caller": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-invalid-this": 2,
"no-multi-spaces": 2,
"no-new-wrappers": 2,
"no-with": 2,
"array-bracket-spacing": [2, "never"],
"brace-style": 2,

"camelcase": [2, {"properties": "never"}],
"comma-spacing": 2,
"comma-style": 2,
"computed-property-spacing": 2,
"func-call-spacing": 2,
"indent": [2, 2, {"SwitchCase": 1}],
"key-spacing": 2,
"keyword-spacing": 2,
"linebreak-style": 2,
"max-len": [2, {"code": 140}],
"no-array-constructor": 2,
"no-multiple-empty-lines": [2, {"max": 2}],
"no-new-object": 2,
"no-trailing-spaces": 2,
"object-curly-spacing": 2,
"quote-props": [2, "consistent"],
"quotes": [2, "single", {"allowTemplateLiterals": true}],
"semi-spacing": 2,
"semi": 2,
"space-before-blocks": 2,
"space-before-function-paren": [2, "never"],
"space-in-parens": 2,
"space-infix-ops": 2,
"spaced-comment": [2, "always"],

"arrow-spacing": 2,
"constructor-super": 2,
"no-confusing-arrow": 2,
"no-const-assign": 2,
"no-dupe-class-members": 2,
"no-duplicate-imports": 2,
"no-this-before-super": 2,
"no-useless-computed-key": 2,
"no-useless-constructor": 2,
"no-useless-rename": 2,
"prefer-const": 2,
"rest-spread-spacing": 2,
"template-curly-spacing": 2,

"no-unused-vars": ["error", { "args": "none" }]
"@typescript-eslint/no-invalid-void-type": "off",
"@typescript-eslint/no-useless-template-literals": "off",
"import/no-unassigned-import": "off",
"max-params": "off",
"sort-keys": "off",
"tsdoc/syntax": "error",
"import/prefer-default-export": "off"
},
"overrides": [{
"files": ["gulpfile.js"],
"parserOptions": {
"ecmaVersion": 2017
}
}]
"ignorePatterns": ["*.cjs"]
}
34 changes: 34 additions & 0 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Validation

on:
push:
branches:
- 'master'
pull_request:
permissions:
contents: read

jobs:
test:
name: Validation
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout Project Code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: Install dependencies and build
run: npm ci
- name: Build TypeScript
run: npm run build
- name: Check TypeScript
run: npm run typecheck
- name: Test
run: npm test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
bower_components
node_modules
build
package-lock.json
dist
coverage

Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"bracketSpacing": true,
"printWidth": 120,
"trailingComma": "all",
"tabWidth": 2,
"singleQuote": true
}
10 changes: 10 additions & 0 deletions .run/All tests.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="All tests" type="JavaScriptTestRunnerKarma">
<config-file value="$PROJECT_DIR$/karma.config.cjs" />
<karma-package-dir value="$PROJECT_DIR$/node_modules/karma" />
<working-directory value="$PROJECT_DIR$" />
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
10 changes: 10 additions & 0 deletions .run/Template Karma.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="true" type="JavaScriptTestRunnerKarma">
<config-file value="$PROJECT_DIR$/karma.config.cjs" />
<karma-package-dir value="$PROJECT_DIR$/node_modules/karma" />
<working-directory value="$PROJECT_DIR$" />
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs](https

- [http://127.0.0.1:8000/components/vaadin-router/demo](http://127.0.0.1:8000/components/vaadin-router/demo)
- Public API tests: [http://127.0.0.1:8000/components/vaadin-router/test](http://127.0.0.1:8000/components/vaadin-router/test)
- Unit tests: [http://127.0.0.1:8000/components/vaadin-router/test/index.coverage.html](http://127.0.0.1:8000/components/vaadin-router/test/index.coverage.html)
- Unit tests: [http://127.0.0.1:8000/components/vaadin-router/test/index.html](http://127.0.0.1:8000/components/vaadin-router/test/index.html)


## Running tests from the command line
Expand Down
26 changes: 0 additions & 26 deletions bower.json

This file was deleted.

14 changes: 0 additions & 14 deletions bs-config.cjs

This file was deleted.

8 changes: 4 additions & 4 deletions demo/demo-shell.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<link rel="import" href="element-demo.html">
<link rel="import" href="vaadin-router-demo-shared-styles.html">

<script src="../dist/vaadin-router.umd.js"></script>
<script>
// In order to make the demos work without the import statement there
window.Router = window.Vaadin.Router;
<script type="module">
import {Router} from '../dist/vaadin-router.js';

window.Router = Router;
</script>

<link rel="import" href="demo-elements/x-home-view.html">
Expand Down
27 changes: 0 additions & 27 deletions gen-tsd.json

This file was deleted.

Loading
Loading