Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add luaurc schema, resolves: #842 #850

Merged
merged 8 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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\\-\\._]+$": {
ernisto marked this conversation as resolved.
Show resolved Hide resolved
"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" }
}
}
}
}
Loading