Skip to content

Commit 223404c

Browse files
committed
Add rule to prevent setting context from outside the ContextManager class
1 parent 2aa197c commit 223404c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.eslintrc.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
"import/internal-regex": "^@/"
2424
},
2525
"overrides": [
26+
{
27+
"files": ["src/core/contextManager.ts"],
28+
"rules": {
29+
"no-restricted-syntax": "off"
30+
}
31+
},
2632
{
2733
"files": ["test/**/*.{ts,tsx}", "**/*.{test,spec}.ts?(x)"],
2834
"settings": {
@@ -110,6 +116,13 @@
110116
"sublings_only": true
111117
}
112118
}
119+
],
120+
"no-restricted-syntax": [
121+
"error",
122+
{
123+
"selector": "CallExpression[callee.property.name='executeCommand'][arguments.0.value='setContext'][arguments.length>=3]",
124+
"message": "Do not use executeCommand('setContext', ...) directly. Use the ContextManager class instead."
125+
}
113126
]
114127
}
115128
}

0 commit comments

Comments
 (0)