angular-typed-router-eslint 0.1.1-3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -2
- package/package.json +21 -1
package/README.md
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
|
-
#
|
|
1
|
+
# angular-typed-router-eslint
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ESLint rules that complement [`angular-typed-router`](../typed-router/README.md) by forbidding patterns that bypass its type safety.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev angular-typed-router-eslint
|
|
9
|
+
# or
|
|
10
|
+
pnpm add -D angular-typed-router-eslint
|
|
11
|
+
# or
|
|
12
|
+
yarn add -D angular-typed-router-eslint
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup (flat config)
|
|
16
|
+
|
|
17
|
+
The package ships a ready-to-use flat config that registers the plugin and enables all rules:
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
// eslint.config.js
|
|
21
|
+
import typedRouter from 'angular-typed-router-eslint/configs/flat-config';
|
|
22
|
+
|
|
23
|
+
export default [
|
|
24
|
+
// ...your other configs
|
|
25
|
+
...typedRouter,
|
|
26
|
+
];
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or wire it up manually if you want to pick rules individually:
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
// eslint.config.js
|
|
33
|
+
import typedRouterPlugin from 'angular-typed-router-eslint';
|
|
34
|
+
|
|
35
|
+
export default [
|
|
36
|
+
{
|
|
37
|
+
files: ['**/*.ts', '**/*.html'],
|
|
38
|
+
plugins: { 'angular-typed-router': typedRouterPlugin },
|
|
39
|
+
rules: {
|
|
40
|
+
'angular-typed-router/no-relative-to-navigation': 'error',
|
|
41
|
+
'angular-typed-router/no-trailing-slash-navigation': 'error',
|
|
42
|
+
// Forbid the untyped Router / RouterLink so contributors can't bypass the typed APIs
|
|
43
|
+
'no-restricted-imports': [
|
|
44
|
+
'error',
|
|
45
|
+
{
|
|
46
|
+
paths: [
|
|
47
|
+
{
|
|
48
|
+
name: '@angular/router',
|
|
49
|
+
importNames: ['Router', 'RouterLink'],
|
|
50
|
+
message: 'Use TypedRouter and TypedRouterLink from angular-typed-router instead.',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## What you get
|
|
61
|
+
|
|
62
|
+
| Rule | What it does |
|
|
63
|
+
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
64
|
+
| `angular-typed-router/no-relative-to-navigation` | Disallows `relativeTo` in `navigate` / `navigateByUrl` / `createUrlTree` calls. Typed paths and commands are absolute. |
|
|
65
|
+
| `angular-typed-router/no-trailing-slash-navigation` | Disallows trailing slashes in `routerLink` attributes and `navigateByUrl` string arguments (auto-fixable). |
|
|
66
|
+
| `no-restricted-imports` (built-in, preconfigured) | Forbids importing `Router` and `RouterLink` from `@angular/router` so contributors can't bypass `TypedRouter` / `TypedRouterLink`. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angular-typed-router-eslint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "ESLint rules that complement angular-typed-router by forbidding patterns that bypass its type safety.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"angular",
|
|
7
|
+
"router",
|
|
8
|
+
"eslint",
|
|
9
|
+
"eslint-plugin",
|
|
10
|
+
"eslintplugin",
|
|
11
|
+
"typescript",
|
|
12
|
+
"angular-typed-router"
|
|
13
|
+
],
|
|
14
|
+
"author": "Dominic Bachmann",
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"homepage": "https://github.com/dominicbachmann/angular-typed-router/tree/main/libs/eslint-plugin#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/dominicbachmann/angular-typed-router/issues"
|
|
19
|
+
},
|
|
4
20
|
"type": "commonjs",
|
|
5
21
|
"main": "./src/index.js",
|
|
6
22
|
"types": "./src/index.d.ts",
|
|
@@ -12,6 +28,10 @@
|
|
|
12
28
|
"dependencies": {
|
|
13
29
|
"tslib": "^2.3.0"
|
|
14
30
|
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@typescript-eslint/utils": "^8.0.0",
|
|
33
|
+
"eslint": "^9.0.0"
|
|
34
|
+
},
|
|
15
35
|
"exports": {
|
|
16
36
|
"./package.json": "./package.json",
|
|
17
37
|
".": {
|