小编Gug*_*der的帖子

在 JS 中声明多个私有类方法时,我收到 ESLINT 警告,为什么?

如果我在类中只声明一个私有方法,则 ESLINT 编译时不会发出警告,但是...\nESLINT 会为我在同一类中声明的每个新私有方法发出一个额外警告。

\n

例如,ESLINT 对于如下声明的类发出 2 个警告:

\n
class Clazz {\n  #methodOne() { /*...*/ }\n  #methodTwo() { /*...*/ }\n  #methodThree() { /*...*/ }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

ESLINT 输出:

\n
WARNING  Compiled with 1 warning                                                                                                                                   10:14:26 PM\n\nModule Warning (from ./node_modules/eslint-loader/index.js):\n\n/Users/***/Clazz.js\n  3:3  error  Duplicate name \'\'  no-dupe-class-members\n  4:3  error  Duplicate name \'\'  no-dupe-class-members\n\n\xe2\x9c\x96 2 problems (2 errors, 0 warnings)\n
Run Code Online (Sandbox Code Playgroud)\n

我想知道我是否做错了什么,或者我应该忽略这些警告。

\n
\n

包.json:

\n
WARNING  Compiled with 1 warning                                                                                                                                   10:14:26 PM\n\nModule Warning (from ./node_modules/eslint-loader/index.js):\n\n/Users/***/Clazz.js\n  3:3  error  Duplicate name \'\'  no-dupe-class-members\n  4:3 …
Run Code Online (Sandbox Code Playgroud)

javascript ecmascript-6 eslint es6-class

8
推荐指数
1
解决办法
768
查看次数

Net5 上的 ServiceProcessInstaller 在哪里?

过去,我使用InstallerServiceInstallerServiceProcessInstaller类来使我的应用程序可自行安装。我只需运行即可InstallUtil.exe MyApp将应用程序安装为 Windows 服务。

但我在 DotNet5 上找不到这些类。

他们不会被移植吗?还有其他方法可以替代它们吗?谁能向我指出一些有关如何实现这一目标的文档?

下面是一个关于过去如何使用这些类的示例:

[RunInstaller(true)]
public class MyServiceInstaller : Installer
{
  private string serviceName = "MyApp";

  public MyServiceInstaller()
  {
    var processInstaller = new ServiceProcessInstaller();
    var serviceInstaller = new ServiceInstaller();

    processInstaller.Account = ServiceAccount.LocalSystem;
    processInstaller.Username = null;
    processInstaller.Password = null;

    serviceInstaller.ServiceName = serviceName;
    serviceInstaller.DisplayName = serviceName;
    serviceInstaller.StartType = ServiceStartMode.Automatic;

    this.Installers.Add(processInstaller);
    this.Installers.Add(serviceInstaller);

    this.Committed += new InstallEventHandler(MyServiceInstaller_Committed);
  }

  void MyServiceInstaller_Committed(object sender, InstallEventArgs e)
  {
    var controller = new ServiceController(serviceName);
    controller.Start();
  } …
Run Code Online (Sandbox Code Playgroud)

c# windows windows-services .net-5

6
推荐指数
1
解决办法
4058
查看次数