diff --git a/configs/mainConfig/mainConfig.cjs b/configs/mainConfig/mainConfig.cjs index 3bedce9..abbad87 100644 --- a/configs/mainConfig/mainConfig.cjs +++ b/configs/mainConfig/mainConfig.cjs @@ -7,6 +7,7 @@ const preferDestructuringRule = require('./preferDestructuringRule.cjs'); const noRestrictedImportsRule = require('./noRestrictedImportsRule.cjs'); const stringEnumRule = require('./stringEnumRule.cjs'); const noEmptyFunctionsRule = require('./noEmptyFunctionsRule.cjs'); +const noRestrictedPropertiesRule = require('./noRestrictedPropertiesRule.cjs'); module.exports = { plugins, @@ -62,5 +63,6 @@ module.exports = { '@typescript-eslint/no-use-before-define': [ERROR, { functions: false }], 'typescript-sort-keys/interface': WARN, 'unused-imports/no-unused-imports': ERROR, + 'no-restricted-properties': noRestrictedPropertiesRule, }, }; diff --git a/configs/mainConfig/noRestrictedPropertiesRule.cjs b/configs/mainConfig/noRestrictedPropertiesRule.cjs new file mode 100644 index 0000000..44aed4a --- /dev/null +++ b/configs/mainConfig/noRestrictedPropertiesRule.cjs @@ -0,0 +1,18 @@ +const { ERROR } = require('../../consts/common.cjs'); + +const testingLibraryRestrictedProperties = [ + 'getByRole', + 'getAllByRole', + 'findByRole', + 'findAllByRole', + 'queryByRole', + 'queryAllByRole', +]; +module.exports = [ + ERROR, + ...testingLibraryRestrictedProperties.map(property => ({ + property, + message: + 'This query is not allowed as it has low performance. Please use other queries instead.', + })), +];