Skip to content

Instantly share code, notes, and snippets.

@dig1t
Created November 13, 2024 17:57
Show Gist options
  • Save dig1t/b0f28c004fe41f074fcc422ca8c67647 to your computer and use it in GitHub Desktop.
Save dig1t/b0f28c004fe41f074fcc422ca8c67647 to your computer and use it in GitHub Desktop.
Repo Files for Styling and Validation
// .vscode/extensions.json
{
"recommendations": [
"evaera.vscode-rojo",
"JohnnyMorganz.luau-lsp",
"Kampfkarren.selene-vscode",
"JohnnyMorganz.stylua"
]
}
# .github/workflows/linter.yml
name: Code Validation
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
jobs:
luau-lsp:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
uses: ok-nick/[email protected]
- name: Download type files
run: curl -L "https://raw.githubusercontent.com/JohnnyMorganz/luau-lsp/main/scripts/globalTypes.d.luau" > globalTypes.d.luau
- name: Install Wally
run: wally install
- name: Generate sourcemaps
run: rojo sourcemap --include-non-scripts --output sourcemap.json
- name: Generate package types
run: wally-package-types --sourcemap sourcemap.json Packages/
- name: Lint with luau-lsp
run: luau-lsp analyze --defs=globalTypes.d.luau --sourcemap=sourcemap.json --no-strict-dm-types --ignore=Packages/** src
selene:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
uses: ok-nick/[email protected]
- name : Lint with selene
run: selene src
// .vscode/settings.json
{
"luau-lsp.diagnostics.workspace": true,
"luau-lsp.sourcemap.enabled": true,
"luau-lsp.sourcemap.rojoProjectFile": "default.project.json",
"luau-lsp.sourcemap.includeNonScripts": false,
"luau-lsp.diagnostics.strictDatamodelTypes": false,
"luau-lsp.ignoreGlobs": [
"**/_Index/**",
"*.d.luau"
],
"[lua]": {
"editor.defaultFormatter": "JohnnyMorganz.stylua",
"editor.formatOnSave": true
},
"[luau]": {
"editor.defaultFormatter": "JohnnyMorganz.stylua",
"editor.formatOnSave": true
},
"stylua.targetReleaseVersion": "latest",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment