File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -151,15 +151,18 @@ function create(context) {
151151
152152 return {
153153 [ lengthSelector ] ( lengthNode ) {
154- let node ;
155- let autoFix = true ;
154+ if ( lengthNode . object . type === 'ThisExpression' ) {
155+ return ;
156+ }
156157
157158 const staticValue = getStaticValue ( lengthNode , context . getScope ( ) ) ;
158159 if ( staticValue && ( ! Number . isInteger ( staticValue . value ) || staticValue . value < 0 ) ) {
159160 // Ignore known, non-positive-integer length properties.
160161 return ;
161162 }
162163
164+ let node ;
165+ let autoFix = true ;
163166 let { isZeroLengthCheck, node : lengthCheckNode } = getLengthCheckNode ( lengthNode ) ;
164167 if ( lengthCheckNode ) {
165168 const { isNegative, node : ancestor } = getBooleanAncestor ( lengthCheckNode ) ;
Original file line number Diff line number Diff line change @@ -138,7 +138,17 @@ test({
138138} ) ;
139139
140140test . snapshot ( {
141- valid : [ ] ,
141+ valid : [
142+ // Ignored
143+ outdent `
144+ class A {
145+ a() {
146+ if (this.length);
147+ while (!this.size || foo);
148+ }
149+ }
150+ `
151+ ] ,
142152 invalid : [
143153 outdent `
144154 if (
You can’t perform that action at this time.
0 commit comments