eslint-plugin

@masknet/no-default-error

Restrict the usage of default (unextended) error

Rule Details

This rule aims to restrict the usage of default errors in the project (in favor of custom ones)

:x: Incorrect

throw Error()
throw new Error()

:white_check_mark: Correct

class UserDefinedError extends Error {
  constructor(message) {
    super(message)
  }
}

throw new UserDefinedError()

Attributes

Thanks

https://github.com/andrewms2013/eslint-plugin-no-default-error