Javascript 识别useStyles中未使用的样式

Javascript 识别useStyles中未使用的样式,javascript,reactjs,visual-studio-code,material-ui,Javascript,Reactjs,Visual Studio Code,Material Ui,我只是花了最后10分钟的时间试图找出我在组件中实际使用的样式,以及哪些是遗留的。这让我想到了一个问题,有没有更好的办法?你如何保持它们干净?我正在为VisualStudio代码(我使用的)寻找某种扩展,但找不到 const useStyles = makeStyles((theme) => ({ actions: { marginTop: theme.spacing(1), }, buttons: { display: "flex" }, con

我只是花了最后10分钟的时间试图找出我在组件中实际使用的样式,以及哪些是遗留的。这让我想到了一个问题,有没有更好的办法?你如何保持它们干净?我正在为VisualStudio代码(我使用的)寻找某种扩展,但找不到

const useStyles = makeStyles((theme) => ({
  actions: {
    marginTop: theme.spacing(1),
  },
  buttons: { display: "flex" },
  connectLinkIcon: {
    fontSize: theme.typography.fontSize * 1.5,
  },
  connectButton: {
    marginLeft: theme.spacing(1),
  },
  connectMenu: {
    border: `1px solid ${theme.palette.grey[300]}`,
  },
  buttonIcon: {
    marginRight: theme.spacing(1),
  },
  listItemIcon: {
    minWidth: 35,
  },
  profileInfo: {
    display: "flex",
  },
  profileInfoText: {
    marginLeft: theme.spacing(1),
  },
  profileAvatar: {
    width: 50,
    height: 50,
  },
  profileName: {
    fontWeight: theme.typography.fontWeightBold,
  },
}));

答案可能取决于您使用的IDE,因此您应该提供infoOh当然可以。我使用visualstudio代码。很抱歉,我忘记了这一部分。Visual Studio代码-然后显而易见的方法是,您可以看到未使用的类将变灰&悬停时,它会显示声明的值,但它永远不会被读取,另外,通过运行应用程序并在浏览器控制台中显示未使用的类,NHMM不确定我是否遗漏了某些内容,因为在我的示例中,
test
在我刚刚添加时没有使用,但它没有变灰,看起来像是它需要的。只有在不使用整个变量时,它才会变灰。如果你想看看是否有任何引用该属性,也许会帮助你。