chore(eslint): add rule to protect against accessing __testing outside of test files

This commit is contained in:
Miodec 2025-09-01 14:25:44 +02:00
parent 12f78e18cb
commit 4d46c62982

View file

@ -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",
},
},
],
};