File tree Expand file tree Collapse file tree 9 files changed +29
-0
lines changed
hermes-eslint/src/scope-manager/scope
hermes-transform/src/transform/mutations Expand file tree Collapse file tree 9 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,16 @@ component_syntax=true
2727enums=true
2828experimental.pattern_matching=true
2929
30+ experimental.constant_condition=true
31+ experimental.constant_condition.null_void.includes=<PROJECT_ROOT>
32+ experimental.constant_condition.boolean_literal.includes=<PROJECT_ROOT>
33+ experimental.constant_condition.function.includes=<PROJECT_ROOT>
34+ experimental.constant_condition.invalid_comparison.general.includes=<PROJECT_ROOT>
35+ experimental.constant_condition.invalid_comparison.null_check.includes=<PROJECT_ROOT>
36+
37+ experimental.natural_inference.array_object_literals.implicit_instantiation_fix=true
38+ experimental.natural_inference.jsx_literal=true
39+
3040[version]
3141^0.283.0
3242
Original file line number Diff line number Diff line change @@ -246,17 +246,24 @@ type VariableScope =
246246 this . type = type ;
247247
248248 this . __dynamic =
249+ // $FlowFixMe[invalid-compare]
249250 this . type === ScopeType . Global || this . type === ScopeType . With ;
250251
251252 this . block = block ;
252253
253254 this . variableScope =
254255 this . type === ScopeType . ClassFieldInitializer ||
256+ // $FlowFixMe[invalid-compare]
255257 this . type === ScopeType . ClassStaticBlock ||
258+ // $FlowFixMe[invalid-compare]
256259 this . type === ScopeType . Function ||
260+ // $FlowFixMe[invalid-compare]
257261 this . type === ScopeType . Global ||
262+ // $FlowFixMe[invalid-compare]
258263 this . type === ScopeType . Module ||
264+ // $FlowFixMe[invalid-compare]
259265 this . type === ScopeType . DeclareModule ||
266+ // $FlowFixMe[invalid-compare]
260267 this . type === ScopeType . DeclareNamespace
261268 ? // $FlowFixMe[incompatible-type] not possible to teach flow this is safe
262269 this
Original file line number Diff line number Diff line change @@ -135,6 +135,7 @@ export function isExpression(node /*: ESNode */) /*: implies node is Expression
135135 node . type === 'ArrayExpression' ||
136136 node . type === 'ObjectExpression' ||
137137 // $FlowFixMe[incompatible-type]
138+ // $FlowFixMe[invalid-compare]
138139 node . type === 'ObjectExpression' ||
139140 node . type === 'FunctionExpression' ||
140141 node . type === 'ArrowFunctionExpression' ||
Original file line number Diff line number Diff line change @@ -753,6 +753,7 @@ function mapTypeofTypeAnnotation(
753753 // $FlowExpectedError[cannot-write]
754754 delete node . typeArguments ;
755755 // $FlowFixMe[incompatible-type]
756+ // $FlowFixMe[invalid-compare]
756757 if ( node . argument . type !== 'GenericTypeAnnotation' ) {
757758 return nodeWith ( node , {
758759 // $FlowExpectedError[incompatible-type] Special override for Babel
@@ -920,6 +921,7 @@ function transformNode(node: ESNodeOrBabelNode): ESNodeOrBabelNode | null {
920921 case 'Program' : {
921922 // Check if we have already processed this node.
922923 // $FlowFixMe[incompatible-type]
924+ // $FlowFixMe[invalid-compare]
923925 if ( node . parent ?. type === 'File' ) {
924926 return node ;
925927 }
@@ -1263,6 +1265,7 @@ export function transformProgram(
12631265 } ) ;
12641266
12651267 // $FlowFixMe[incompatible-type]
1268+ // $FlowFixMe[invalid-compare]
12661269 if ( resultNode ?. type === 'File' ) {
12671270 return resultNode ;
12681271 }
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ function getParentKey(
4848 parent [ key ] ,
4949 )
5050 ) {
51+ // $FlowFixMe[invalid-compare]
5152 if ( parent [ key ] === target ) {
5253 return { type : 'single' , node : parent , key} ;
5354 }
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ export function performModifyNodeInPlaceMutation(
4040 const prevPropValue = target [ key ] ;
4141
4242 // If the value did not change, skip.
43+ // $FlowFixMe[invalid-compare]
4344 if ( prevPropValue === newPropValue ) {
4445 continue ;
4546 }
Original file line number Diff line number Diff line change @@ -216,6 +216,7 @@ function getRemovalParent(node: RemoveNodeMutation['node']): $ReadOnly<{
216216 return 'properties ';
217217
218218 // $FlowFixMe[incompatible-type]
219+ // $FlowFixMe[invalid-compare]
219220 case 'OptionalCallExpression ':
220221 case 'CallExpression ':
221222 case 'NewExpression ':
@@ -247,6 +248,7 @@ function getRemovalParent(node: RemoveNodeMutation['node']): $ReadOnly<{
247248 return 'properties ';
248249
249250 // $FlowFixMe[incompatible-type]
251+ // $FlowFixMe[invalid-compare]
250252 case 'OptionalCallExpression ':
251253 case 'CallExpression ':
252254 case 'NewExpression ':
@@ -275,6 +277,7 @@ function getRemovalParent(node: RemoveNodeMutation['node']): $ReadOnly<{
275277 // $FlowExpectedError[prop-missing]
276278 const arr = node . parent [ key ] ;
277279 const idx = arr . indexOf ( node ) ;
280+ // $FlowFixMe[invalid-compare]
278281 if ( idx === - 1 ) {
279282 throw new InvalidRemovalError (
280283 `Could not find target in array of \`${ node . parent . type } .${ key } \`.` ,
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ function getParentKey(target: ESNode): $ReadOnly<
9090 for ( const key of getVisitorKeys ( parent ) ) {
9191 const child = ( parent : $FlowFixMe ) [ key ] ;
9292 if ( isNode ( child ) ) {
93+ // $FlowFixMe[invalid-compare]
9394 if ( child === target ) {
9495 return { type : 'single' , parent, key} ;
9596 }
Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ export function getStatementParent(
4545 const value = parentWithType [ key ] ;
4646
4747 if (
48+ // $FlowFixMe[invalid-compare]
4849 value === target ||
4950 ( Array . isArray ( value ) && value . includes ( target ) )
5051 ) {
@@ -136,6 +137,7 @@ export function getStatementParent(
136137 // array insertions are already validated by the getAssertedIndex function
137138 result . targetIndex == null &&
138139 // $FlowExpectedError[prop-missing]
140+ // $FlowFixMe[invalid-compare]
139141 result . parent [ result . key ] !== target
140142 ) {
141143 throw new InvalidStatementError (
You can’t perform that action at this time.
0 commit comments