Skip to content

require-context-valid-class

The class used in the #RequireContext directive must be a valid script execution context

INFO

☑️ The predefined configuration "mslint:recommended" enables this rule.

Rule details

This rule requires a valid script execution context to be used in the #RequireContext directive.

Valid contexts are :

  • CManiaAppTitle
  • CManiaAppStation
  • CManiaAppPlayground
  • CSmMode
  • CTmMode
  • CSmMapType
  • CTmMapType
  • CMapEditorPlugin
  • CServerPlugin
  • CSmAction
  • CManiaplanetPlugin
  • CAnyEditorPlugin

Settings

  • validClasses a list of class names that are considered valid by the rule. Default [].
  • invalidClasses a list of class names that are considered invalid by the rule. Default [].

Example of incorrect code for this rule:

maniascript
/*
{
  "validClasses" = ["CPlayer"],
  "invalidClasses" = ["CMode"]
}
*/
#RequireContext CSmPlayer
#RequireContext CUser
#RequireContext CMode

Example of correct code for this rule:

maniascript
/*
{
  "validClasses" = ["CPlayer"],
  "invalidClasses" = ["CMode"]
}
*/
#RequireContext CPlayer
#RequireContext CManiaAppTitle
#RequireContext CManiaAppStation
#RequireContext CManiaAppPlayground
#RequireContext CSmMode
#RequireContext CTmMode
#RequireContext CSmMapType
#RequireContext CTmMapType
#RequireContext CMapEditorPlugin
#RequireContext CServerPlugin
#RequireContext CSmAction
#RequireContext CManiaplanetPlugin
#RequireContext CAnyEditorPlugin

Resources