Skip to content

Commit

Permalink
Added no restricted propreties rule [WWW-1215]
Browse files Browse the repository at this point in the history
  • Loading branch information
prztrz committed Oct 16, 2024
1 parent a8a22ed commit 6b53208
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions configs/mainConfig/mainConfig.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
},
};
18 changes: 18 additions & 0 deletions configs/mainConfig/noRestrictedPropertiesRule.cjs
Original file line number Diff line number Diff line change
@@ -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.',
})),
];

0 comments on commit 6b53208

Please sign in to comment.