r5n-dev / vscode-react-javascript-snippets

Extension for React/Javascript snippets with search supporting ES7+ and babel features
MIT License
1.71k stars 440 forks source link

En dash on file name causes invalid syntax #258

Open marcosmarp opened 2 years ago

marcosmarp commented 2 years ago

When using a snippet that uses the current file name, and that file name have a - on it, it causes invalid syntax.

Example with tsrafce

import React from 'react'

type Props = {}

const delete-modal= (props: Props) => {
  return (
    <div>delete-modal</div>
  )
}

export default delete-modal

A - on a function name isn't valid so something like this would be nice:

import React from 'react'

type Props = {}

const DeleteModal = (props: Props) => {
  return (
    <div>delete-modal</div>
  )
}

export default DeleteModal;

Thanks!