@codelaw/rules-stencil 0.0.0-stage → 0.2.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/LICENSE +23 -0
- package/NOTICE +6 -0
- package/README.md +44 -2
- package/codelaw-pack.toml +6 -0
- package/corpus.toml +22 -0
- package/package.json +14 -4
- package/presets/stencil/conventions.toml +4 -0
- package/presets/stencil/recommended.toml +20 -0
- package/rules/stencil/ban-default-true.md +70 -0
- package/rules/stencil/ban-exported-const-enums.md +60 -0
- package/rules/stencil/ban-prefix.md +76 -0
- package/rules/stencil/ban-side-effects.md +81 -0
- package/rules/stencil/decorators-context.md +61 -0
- package/rules/stencil/enforce-slot-jsdoc.md +68 -0
- package/rules/stencil/host-data-deprecated.md +73 -0
- package/rules/stencil/methods-must-be-public.md +69 -0
- package/rules/stencil/no-unused-watch.md +68 -0
- package/rules/stencil/own-methods-must-be-private.md +68 -0
- package/rules/stencil/own-props-must-be-private.md +60 -0
- package/rules/stencil/prefer-vdom-listener.md +67 -0
- package/rules/stencil/prop-readonly.md +63 -0
- package/rules/stencil/props-must-be-public.md +68 -0
- package/rules/stencil/required-jsdoc.md +66 -0
- package/rules/stencil/reserved-member-names.md +70 -0
- package/rules/stencil/strict-mutable.md +75 -0
- package/rules/stencil/tag-prefix.md +75 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: stencil/tag-prefix
|
|
3
|
+
title: "Component tags start with the project's prefix"
|
|
4
|
+
languages: [typescript, tsx]
|
|
5
|
+
fix: manual
|
|
6
|
+
fix_reason: "renaming a tag changes every page that uses it"
|
|
7
|
+
stability: preview
|
|
8
|
+
options:
|
|
9
|
+
prefix: { type: string, default: "", description: "the prefix every tag must start with" }
|
|
10
|
+
since: 0.1.0
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
Every component's `tag` starts with the project's prefix (the `prefix` option); with no prefix set,
|
|
14
|
+
a tag still needs one.
|
|
15
|
+
|
|
16
|
+
**Why:** One prefix keeps a project's elements apart from other libraries'.
|
|
17
|
+
|
|
18
|
+
```codelaw
|
|
19
|
+
native: stencil/tag-prefix
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## How to fix
|
|
23
|
+
|
|
24
|
+
1. Rename the tag to start with the project's prefix.
|
|
25
|
+
2. Update every usage of the element.
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
### TypeScript
|
|
30
|
+
|
|
31
|
+
#### Don't
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
@Component({ tag: 'card' })
|
|
35
|
+
export class Card {
|
|
36
|
+
render() {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### Do
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
@Component({ tag: 'acme-card' })
|
|
46
|
+
export class Card {
|
|
47
|
+
render() {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### TSX
|
|
54
|
+
|
|
55
|
+
#### Don't
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
@Component({ tag: 'card' })
|
|
59
|
+
export class Card {
|
|
60
|
+
render() {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### Do
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
@Component({ tag: 'acme-card' })
|
|
70
|
+
export class Card {
|
|
71
|
+
render() {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|