pulkitgangwar / next.js-snippets

Nextjs snippets extension
https://marketplace.visualstudio.com/items?itemName=PulkitGangwar.nextjs-snippets
MIT License
26 stars 6 forks source link

ntsapi warnings #5

Closed bfourgeaud closed 1 year ago

bfourgeaud commented 2 years ago

ntsapi scaffolds a default arrow function export. Visual Studio code complains (warning) that we should assign that arrow function to a variable before exporting. I would suggest changing the template in order to remove the warning if possible.

Current (warning displayed) :

import { NextApiRequest, NextApiResponse } from 'next';

export default (req:NextApiRequest, res:NextApiResponse) => {
  req.statusCode = 200
}

Suggestion (no warning) :

import { NextApiRequest, NextApiResponse } from 'next';

const handle = (req:NextApiRequest, res:NextApiResponse) => {
  req.statusCode = 200
}

export default handle

And by the way, thank you for the plugin, It's much useful ;)