Skip to content

Commit d88ea97

Browse files
LodinplatoshaZheSun88
authoredOct 7, 2024··
refactor!: move Router fully to TypeScript (#886)
* feat!: replace umd and esm bundles with esm for distribution Fixes #828 * chore: remove gen-typescript-declarations dependency * build: separate tsconfig.json for build and test * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * --wip-- [skip ci] * chore: remove interfaces.d.ts * test: add vite, karma, mocha devDeps * --wip-- [skip ci] * test: fix .nested.property assertions * fix: match parent route when route.children is truthy * refactor: improve types and move them to d.ts * refactor: move generatedUrls spec to TS * refactor: move matchPath spec to TS * refactor: move dynamic-redirect spec to TS * chore: update config files * refactor: cleanup code & move to async-await to resolve the dynamic-redirect issues * chore: improve Karma config * refactor: improve code & tests * refactor: move code/tests to plain TS files * test: fix most of the test issues * refactor: add some types to utils and to supplementary declaration file * chore: update dependencies * test: disable several failing tests * refactor: redirect type import * refactor: add typings for generateUrls module * chore: add eslint-config-vaadin and perfectionist plugin * refactor: make path not required * refactor: finalize matchPath & matchRoute functions * chore: get back Mocha reporter in Karma * refactor: improve typings for Resolver * refactor: improve typings for Resolver [2] * build: update dependencies and remove install blockers * build: add separate compile tsconfig * fix: some TypeScript errors * refactor: update typings for the Router * chore: remove unnecessary import * test: fix karma setup * refactor: improve typings & update some tests * test: remove ShadyDOM suite marking * fix: matching routes with empty children * test: remove test for { path: null } route * test: relax asserting { done: false } iterator result to falsy * add github action validation file * remove unnecessary travis file * fix: Resolver not found error handling * refactor: fix some typings & update tests * fix: restore resolver children behaviour * test: enable lifecycle events test * fix: Params array support * refactor: restore context result type returned from resolve() * refactor: fix typings & update more tests * refactor: use RouteContext type in resolve callback argument * refactor: remove promise from onAfterEnter / onAfterLeave * fix: workflow around resolve next(), unwrap context result * test: use spec reporter with karma * test: avoid errorneous initial render from setRoutes * test: fix TypeScript error in matchRoute suite * test: adjust assertion for async setRoutes method * test: fix checkOutlet utility function * test: test suite structure * fix: carry locaiton.redirectFrom from redirect context * refactor: make Resolver typings more agnostic * test: address some ESlint feedback in tests * test: address more ESlint feedback in tests * test: fix syntax * test: bypass TypeScript errors in some tests * test: avoid errorneous initial render from setRoutes * fix: support sync render() use cases * fix: support params in getUrl() * chore: make render async again * test: ensure consistent initial location in router tests * refactor: address more TypeScript / ESLint feedback * fix: runtime behaviour for primitive resolve results * fix: remove next from children context * test: support route errors also from setRoutes * test: avoid deep.property assertions on Element * test(resolver): resolver result is wrapped in context * refactor: support more urlFor param types * fix: support using view component name in urlFor * refactor: finalize Resolver * refactor: restore ensureRoute / ensureRoutes / fireRouterEvent utils * fix: support symbolic NotFoundResult * fix: router lifecycle use cases * test: more correct timing in simultanious callback tests * refactor: continue working on the Router typings * refactor: almost finalize Router typings * fix: matching parameterized routes * refactor: attempt to resolve the most stubborn types * refactor: address TypeScript / ESLint errors * refactor: fix TypeScript type for action * refactor: fix TypeScript type for action * refactor: improve typings * fix: make `commands` in action required * fix: type for default resolveRoute implementation * test: make tests run again * test: use spy instead of stub for updated sinon API * fix: remove next from children context * refactor: continue moving to typescript in tests * style: lint * style: format * fix: prevent extra onBeforeLeave lifecycle callback calls * refactor: rollback testing-library changes to avoid test breaks * refactor: small fixes * refactor: use native private props in router * refactor: fix TS errors * refactor: get back test search * fix: remove next from children context * test: avoid erroneous parallel assertions * build: add TypeScript validation steps * test: fix error in TypeScript fixture * refactor: cleanup & deps update * build: add TypeScript declaration files * build: add TypeScript declaration files * refactor!: remove bower support * refactor!: remove documentation-only interfaces --------- Co-authored-by: Anton Platonov <platosha@gmail.com> Co-authored-by: Zhe Sun <zhe@vaadin.com>
1 parent f5f31e0 commit d88ea97

File tree

94 files changed

+22968
-25207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+22968
-25207
lines changed
 

‎.eslintrc.json

+16-70
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,23 @@
11
{
2-
"extends": "eslint:recommended",
3-
"env": {
4-
"browser": true,
5-
"node": true,
6-
"es6": true
7-
},
8-
"plugins": [
9-
"html"
2+
"extends": [
3+
"vaadin/typescript-requiring-type-checking",
4+
"vaadin/imports-typescript",
5+
"vaadin/prettier",
6+
"vaadin/testing",
7+
"plugin:oxlint/recommended"
108
],
11-
"globals": {
12-
"Polymer": false,
13-
"Vaadin": false
14-
},
159
"parserOptions": {
16-
"sourceType": "module"
10+
"project": "./tsconfig.json"
1711
},
12+
"plugins": ["tsdoc"],
1813
"rules": {
19-
"curly": 2,
20-
"no-caller": 2,
21-
"no-extend-native": 2,
22-
"no-extra-bind": 2,
23-
"no-invalid-this": 2,
24-
"no-multi-spaces": 2,
25-
"no-new-wrappers": 2,
26-
"no-with": 2,
27-
"array-bracket-spacing": [2, "never"],
28-
"brace-style": 2,
29-
30-
"camelcase": [2, {"properties": "never"}],
31-
"comma-spacing": 2,
32-
"comma-style": 2,
33-
"computed-property-spacing": 2,
34-
"func-call-spacing": 2,
35-
"indent": [2, 2, {"SwitchCase": 1}],
36-
"key-spacing": 2,
37-
"keyword-spacing": 2,
38-
"linebreak-style": 2,
39-
"max-len": [2, {"code": 140}],
40-
"no-array-constructor": 2,
41-
"no-multiple-empty-lines": [2, {"max": 2}],
42-
"no-new-object": 2,
43-
"no-trailing-spaces": 2,
44-
"object-curly-spacing": 2,
45-
"quote-props": [2, "consistent"],
46-
"quotes": [2, "single", {"allowTemplateLiterals": true}],
47-
"semi-spacing": 2,
48-
"semi": 2,
49-
"space-before-blocks": 2,
50-
"space-before-function-paren": [2, "never"],
51-
"space-in-parens": 2,
52-
"space-infix-ops": 2,
53-
"spaced-comment": [2, "always"],
54-
55-
"arrow-spacing": 2,
56-
"constructor-super": 2,
57-
"no-confusing-arrow": 2,
58-
"no-const-assign": 2,
59-
"no-dupe-class-members": 2,
60-
"no-duplicate-imports": 2,
61-
"no-this-before-super": 2,
62-
"no-useless-computed-key": 2,
63-
"no-useless-constructor": 2,
64-
"no-useless-rename": 2,
65-
"prefer-const": 2,
66-
"rest-spread-spacing": 2,
67-
"template-curly-spacing": 2,
68-
69-
"no-unused-vars": ["error", { "args": "none" }]
14+
"@typescript-eslint/no-invalid-void-type": "off",
15+
"@typescript-eslint/no-useless-template-literals": "off",
16+
"import/no-unassigned-import": "off",
17+
"max-params": "off",
18+
"sort-keys": "off",
19+
"tsdoc/syntax": "error",
20+
"import/prefer-default-export": "off"
7021
},
71-
"overrides": [{
72-
"files": ["gulpfile.js"],
73-
"parserOptions": {
74-
"ecmaVersion": 2017
75-
}
76-
}]
22+
"ignorePatterns": ["*.cjs"]
7723
}

‎.github/workflows/validation.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Validation
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
pull_request:
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
test:
13+
name: Validation
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 15
16+
17+
steps:
18+
- name: Checkout Project Code
19+
uses: actions/checkout@v3
20+
with:
21+
ref: ${{ github.event.pull_request.head.sha }}
22+
fetch-depth: 0
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: 'lts/*'
27+
- name: Install dependencies and build
28+
run: npm ci
29+
- name: Build TypeScript
30+
run: npm run build
31+
- name: Check TypeScript
32+
run: npm run typecheck
33+
- name: Test
34+
run: npm test

0 commit comments

Comments
 (0)
Please sign in to comment.