Skip to content

Commit

Permalink
adding return types to function declarations, see phetsims/chipper#1288
Browse files Browse the repository at this point in the history
  • Loading branch information
jessegreenberg authored and zepumph committed Oct 22, 2024
1 parent 6571125 commit d288686
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions eslint/rules/explicit-method-return-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,23 @@ module.exports = {
},
create: context => {
return {
// FunctionDeclaration: node => {
// if ( !node.returnType ) {
//
// context.report( {
// message: 'Missing return type.',
// node: node,
//
// // Comment out for next time we need this fixer, but it requires type info, where the rule doesn't, so don't always include it.
// fix: fixer => { // eslint-disable-line
//
// const returnTypeString = getReturnTypeString( context, node );
// const bodyStart = node.body.range[ 0 ];
// return insertReturnType( bodyStart, returnTypeString, fixer );
// }
// } );
// }
// },
FunctionDeclaration: node => {
if ( !node.returnType ) {

context.report( {
message: 'Missing return type.',
node: node,

// Comment out for next time we need this fixer, but it requires type info, where the rule doesn't, so don't always include it.
fix: fixer => {

const returnTypeString = getReturnTypeString( context, node );
const bodyStart = node.body.range[ 0 ];
return insertReturnType( bodyStart, returnTypeString, fixer );
}
} );
}
},
MethodDefinition: node => {
if ( !exemptMethods.includes( node.kind ) && node.value && !node.value.returnType ) {

Expand Down

0 comments on commit d288686

Please sign in to comment.