Skip to content

Commit

Permalink
feat: add luaurc schema, resolves: #842 (#850)
Browse files Browse the repository at this point in the history
  • Loading branch information
ernisto authored Dec 8, 2024
1 parent 20d22d5 commit aa6c634
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
6 changes: 6 additions & 0 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@
}
}
],
"jsonValidation": [
{
"fileMatch": ".luaurc",
"url": "./schemas/luaurc.json"
}
],
"commands": [
{
"command": "luau-lsp.updateApi",
Expand Down
104 changes: 104 additions & 0 deletions editors/code/schemas/luaurc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
"$id": "https://json.schemastore.org/luaurc.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"type": "object",
"properties": {
"languageMode": {
"title": "Type checking mode",
"description": "A option that will affect which errors will be detected.",
"default": "nonstrict",
"examples": [
"strict"
],
"type": "string",
"enum": ["strict", "nonstrict", "nocheck"]
},
"lintErrors": {
"title": "Report lint errors",
"description": "A boolean that controls whether lint issues are reported as errors or warnings.",
"default": "false",
"examples": [
"true"
],
"type": "boolean"
},
"typeErrors": {
"title": "Report type errors",
"description": "A boolean that controls whether type issues are reported as errors or warnings.",
"default": "true",
"examples": [
"false"
],
"type": "boolean"
},
"globals": {
"title": "Extra global values",
"description": "An array of strings where each string names a global that the type checker and linter must assume is valid and of type any.",
"examples": [
[ "describe", "it", "expect" ],
[ "warn" ]
],
"type": "array",
"items": { "type": "string", "pattern": "^[a-zA-Z_]\\w*" }
},
"aliases": {
"title": "Require path aliases",
"description": "The path is resolved by first checking if the first word is an alias defined in a .luaurc file. If so, we perform a string substitution.",
"examples": [
{ "Roact": "C:/LuauModules/Roact-v1.4.2" },
{ "@lib": "packages/lib" }
],
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^(?!\\.{1,2}$)(?!.*\\/)[a-zA-Z0-9\\-\\._]+$": {
"type": "string"
}
}
},
"lint": {
"title": "Lints to enable",
"description": "Points to an object that maps string literals that correspond to the names of linting rules (see https://luau-lang.org/lint), or \"*\" that means \"all rules\", to a boolean (to enable/disable the lint)",
"examples": [
{ "*": false, "FormatString": true },
{ "LocalShadow": false }
],
"$comment": "source: https://github.com/luau-lang/luau/blob/master/Config/include/Luau/LinterConfig.h",
"type": "object",
"additionalProperties": false,
"properties": {
"*": { "type": "boolean" },
"UnknownGlobal": { "type": "boolean" },
"DeprecatedGlobal": { "type": "boolean" },
"GlobalUsedAsLocal": { "type": "boolean" },
"LocalShadow": { "type": "boolean" },
"SameLineStatement": { "type": "boolean" },
"MultiLineStatement": { "type": "boolean" },
"LocalUnused": { "type": "boolean" },
"FunctionUnused": { "type": "boolean" },
"ImportUnused": { "type": "boolean" },
"BuiltinGlobalWrite": { "type": "boolean" },
"PlaceholderRead": { "type": "boolean" },
"UnreachableCode": { "type": "boolean" },
"UnknownType": { "type": "boolean" },
"ForRange": { "type": "boolean" },
"UnbalancedAssignment": { "type": "boolean" },
"ImplicitReturn": { "type": "boolean" },
"DuplicateLocal": { "type": "boolean" },
"FormatString": { "type": "boolean" },
"TableLiteral": { "type": "boolean" },
"UninitializedLocal": { "type": "boolean" },
"DuplicateFunction": { "type": "boolean" },
"DeprecatedApi": { "type": "boolean" },
"TableOperations": { "type": "boolean" },
"DuplicateCondition": { "type": "boolean" },
"MisleadingAndOr": { "type": "boolean" },
"CommentDirective": { "type": "boolean" },
"IntegerParsing": { "type": "boolean" },
"ComparisonPrecedence": { "type": "boolean" },
"RedundantNativeAttribute": { "type": "boolean" }
}
}
}
}

0 comments on commit aa6c634

Please sign in to comment.