@@ -49,7 +49,6 @@ export const allowedArrayMethods = new Set([
4949 "includes" ,
5050 "join" ,
5151 "slice" ,
52- "find" ,
5352 "filter" ,
5453] ) ;
5554
@@ -96,43 +95,8 @@ export const lintExpression = ({
9695 sourceType : "module" ,
9796 } ) ;
9897
99- // Track arrow functions that are used as callbacks for safe array methods
100- type ArrowFunctionNode = Node & { type : "ArrowFunctionExpression" } ;
101- const allowedArrowFunctions = new Set < ArrowFunctionNode > ( ) ;
102- // Track arrow function parameters to skip validation
103- const arrowFunctionParams = new Set < string > ( ) ;
104-
105- // First pass: identify arrow functions used in safe contexts
106- simple ( root , {
107- CallExpression ( node ) {
108- if ( node . callee . type === "MemberExpression" ) {
109- if ( node . callee . property . type === "Identifier" ) {
110- const methodName = node . callee . property . name ;
111- if ( allowedArrayMethods . has ( methodName ) ) {
112- // Mark arrow function arguments as allowed
113- for ( const arg of node . arguments ) {
114- if ( arg . type === "ArrowFunctionExpression" ) {
115- allowedArrowFunctions . add ( arg ) ;
116- // Collect parameter names
117- for ( const param of arg . params ) {
118- if ( param . type === "Identifier" ) {
119- arrowFunctionParams . add ( param . name ) ;
120- }
121- }
122- }
123- }
124- }
125- }
126- }
127- } ,
128- } ) ;
129-
13098 simple ( root , {
13199 Identifier ( node ) {
132- // Skip validation for arrow function parameters
133- if ( arrowFunctionParams . has ( node . name ) ) {
134- return ;
135- }
136100 if ( availableVariables . has ( node . name ) === false ) {
137101 addMessage (
138102 `"${ node . name } " is not defined in the scope` ,
@@ -196,12 +160,7 @@ export const lintExpression = ({
196160 } ,
197161 NewExpression : addMessage ( "Classes are not supported" ) ,
198162 SequenceExpression : addMessage ( `Only single expression is supported` ) ,
199- ArrowFunctionExpression ( node ) {
200- // Allow arrow functions only when used as callbacks for safe array methods
201- if ( ! allowedArrowFunctions . has ( node ) ) {
202- addMessage ( "Functions are not supported" ) ( node ) ;
203- }
204- } ,
163+ ArrowFunctionExpression : addMessage ( "Functions are not supported" ) ,
205164 TaggedTemplateExpression : addMessage ( "Tagged template is not supported" ) ,
206165 ClassExpression : addMessage ( "Classes are not supported" ) ,
207166 MetaProperty : addMessage ( "Imports are not supported" ) ,
0 commit comments