Commits
Yury Bondarenko authored 9a27db3835a
91 91 | } |
92 92 | |
93 93 | return ops; |
94 94 | }, |
95 95 | }); |
96 96 | } |
97 97 | |
98 98 | // ignore tests and non-routing modules |
99 99 | if (context.getFilename()?.endsWith('.spec.ts')) { |
100 100 | return { |
101 - | [`CallExpression[callee.object.name = "By"][callee.property.name = "css"] > Literal[value = /.*${DISALLOWED_THEME_SELECTORS}.*/]`](node: any) { |
101 + | [`CallExpression[callee.object.name = "By"][callee.property.name = "css"] > Literal:first-child[value = /.*${DISALLOWED_THEME_SELECTORS}.*/]`](node: any) { |
102 + | context.report({ |
103 + | node, |
104 + | messageId: 'mustUseThemedWrapper', |
105 + | fix(fixer: any){ |
106 + | const newSelector = fixSelectors(node.raw); |
107 + | return fixer.replaceText(node, newSelector); |
108 + | } |
109 + | }); |
110 + | }, |
111 + | }; |
112 + | } else if (context.getFilename()?.endsWith('.cy.ts')) { |
113 + | return { |
114 + | [`CallExpression[callee.object.name = "cy"][callee.property.name = "get"] > Literal:first-child[value = /.*${DISALLOWED_THEME_SELECTORS}.*/]`](node: any) { |
102 115 | context.report({ |
103 116 | node, |
104 117 | messageId: 'mustUseThemedWrapper', |
105 118 | fix(fixer: any){ |
106 119 | const newSelector = fixSelectors(node.raw); |
107 120 | return fixer.replaceText(node, newSelector); |
108 121 | } |
109 122 | }); |
110 123 | }, |
111 124 | }; |