Skip to content

Commit b8e3f35

Browse files
committed
implement
1 parent afc47e4 commit b8e3f35

26 files changed

+896
-0
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ These rules relate to possible syntax or logic errors in Svelte code:
320320
| [svelte/require-store-callbacks-use-set-param](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-store-callbacks-use-set-param/) | store callbacks must use `set` param | |
321321
| [svelte/require-store-reactive-access](https://sveltejs.github.io/eslint-plugin-svelte/rules/require-store-reactive-access/) | disallow to use of the store itself as an operand. Need to use $ prefix or get function. | :wrench: |
322322
| [svelte/valid-compile](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-compile/) | disallow warnings when compiling. | :star: |
323+
| [svelte/valid-context-access](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-context-access/) | context functions must be called during component initialization. | |
323324
| [svelte/valid-prop-names-in-kit-pages](https://sveltejs.github.io/eslint-plugin-svelte/rules/valid-prop-names-in-kit-pages/) | disallow props other than data or errors in Svelte Kit page components. | |
324325

325326
## Security Vulnerability

Diff for: a.json

+227
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
{
2+
"type": "Program",
3+
"body": [
4+
{
5+
"type": "SvelteScriptElement",
6+
"name": {
7+
"type": "SvelteName",
8+
"name": "script"
9+
},
10+
"startTag": {
11+
"type": "SvelteStartTag",
12+
"attributes": [],
13+
"selfClosing": false
14+
},
15+
"body": [
16+
{
17+
"type": "ImportDeclaration",
18+
"specifiers": [
19+
{
20+
"type": "ImportSpecifier",
21+
"imported": {
22+
"type": "Identifier",
23+
"name": "setContext"
24+
},
25+
"local": {
26+
"type": "Identifier",
27+
"name": "setContext"
28+
}
29+
},
30+
{
31+
"type": "ImportSpecifier",
32+
"imported": {
33+
"type": "Identifier",
34+
"name": "onMount"
35+
},
36+
"local": {
37+
"type": "Identifier",
38+
"name": "onMount"
39+
}
40+
}
41+
],
42+
"source": {
43+
"type": "Literal",
44+
"value": "svelte",
45+
"raw": "\"svelte\""
46+
}
47+
},
48+
{
49+
"type": "ExpressionStatement",
50+
"expression": {
51+
"type": "CallExpression",
52+
"callee": {
53+
"type": "ArrowFunctionExpression",
54+
"id": null,
55+
"expression": false,
56+
"generator": false,
57+
"async": false,
58+
"params": [],
59+
"body": {
60+
"type": "BlockStatement",
61+
"body": [
62+
{
63+
"type": "ExpressionStatement",
64+
"expression": {
65+
"type": "CallExpression",
66+
"callee": {
67+
"type": "Identifier",
68+
"name": "setContext"
69+
},
70+
"arguments": [
71+
{
72+
"type": "Literal",
73+
"value": "answer",
74+
"raw": "\"answer\""
75+
},
76+
{
77+
"type": "Literal",
78+
"value": 42,
79+
"raw": "42"
80+
}
81+
],
82+
"optional": false
83+
}
84+
}
85+
]
86+
}
87+
},
88+
"arguments": [],
89+
"optional": false
90+
}
91+
}
92+
],
93+
"endTag": {
94+
"type": "SvelteEndTag"
95+
}
96+
}
97+
],
98+
"comments": [
99+
{
100+
"type": "Block",
101+
"value": " eslint svelte/valid-context-access: \"error\" "
102+
}
103+
],
104+
"sourceType": "module",
105+
"tokens": [
106+
{
107+
"type": "Punctuator",
108+
"value": "<"
109+
},
110+
{
111+
"type": "HTMLIdentifier",
112+
"value": "script"
113+
},
114+
{
115+
"type": "Punctuator",
116+
"value": ">"
117+
},
118+
{
119+
"type": "Keyword",
120+
"value": "import"
121+
},
122+
{
123+
"type": "Punctuator",
124+
"value": "{"
125+
},
126+
{
127+
"type": "Identifier",
128+
"value": "setContext"
129+
},
130+
{
131+
"type": "Punctuator",
132+
"value": ","
133+
},
134+
{
135+
"type": "Identifier",
136+
"value": "onMount"
137+
},
138+
{
139+
"type": "Punctuator",
140+
"value": "}"
141+
},
142+
{
143+
"type": "Identifier",
144+
"value": "from"
145+
},
146+
{
147+
"type": "String",
148+
"value": "\"svelte\""
149+
},
150+
{
151+
"type": "Punctuator",
152+
"value": "("
153+
},
154+
{
155+
"type": "Punctuator",
156+
"value": "("
157+
},
158+
{
159+
"type": "Punctuator",
160+
"value": ")"
161+
},
162+
{
163+
"type": "Punctuator",
164+
"value": "=>"
165+
},
166+
{
167+
"type": "Punctuator",
168+
"value": "{"
169+
},
170+
{
171+
"type": "Identifier",
172+
"value": "setContext"
173+
},
174+
{
175+
"type": "Punctuator",
176+
"value": "("
177+
},
178+
{
179+
"type": "String",
180+
"value": "\"answer\""
181+
},
182+
{
183+
"type": "Punctuator",
184+
"value": ","
185+
},
186+
{
187+
"type": "Numeric",
188+
"value": "42"
189+
},
190+
{
191+
"type": "Punctuator",
192+
"value": ")"
193+
},
194+
{
195+
"type": "Punctuator",
196+
"value": "}"
197+
},
198+
{
199+
"type": "Punctuator",
200+
"value": ")"
201+
},
202+
{
203+
"type": "Punctuator",
204+
"value": "("
205+
},
206+
{
207+
"type": "Punctuator",
208+
"value": ")"
209+
},
210+
{
211+
"type": "Punctuator",
212+
"value": "<"
213+
},
214+
{
215+
"type": "Punctuator",
216+
"value": "/"
217+
},
218+
{
219+
"type": "HTMLIdentifier",
220+
"value": "script"
221+
},
222+
{
223+
"type": "Punctuator",
224+
"value": ">"
225+
}
226+
]
227+
}

0 commit comments

Comments
 (0)