mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-06 15:34:06 +08:00
chore(eslint): add rule to protect against accessing __testing outside of test files
This commit is contained in:
parent
12f78e18cb
commit
4d46c62982
1 changed files with 24 additions and 0 deletions
|
|
@ -24,4 +24,28 @@ module.exports = {
|
|||
settings: {
|
||||
lintAllEsApis: true,
|
||||
},
|
||||
rules: {
|
||||
// Prevent accessing __testing outside of test files
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
{
|
||||
selector: "MemberExpression[property.name='__testing']",
|
||||
message:
|
||||
"__testing should only be accessed in test files. Use the public API instead.",
|
||||
},
|
||||
],
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
// Allow __testing access in test files
|
||||
files: [
|
||||
"**/__tests__/**/*.{js,ts,tsx}",
|
||||
"**/*.{test,spec}.{js,ts,tsx}",
|
||||
"**/tests/**/*.{js,ts,tsx}",
|
||||
],
|
||||
rules: {
|
||||
"no-restricted-syntax": "off",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue