add linting

pull/128/head
Muhammad Atif Ali 1 year ago
parent 82a2d59c14
commit 536bebadd2

@ -30,7 +30,7 @@ module "code-server" {
source = "registry.coder.com/modules/code-server/coder"
version = "1.0.1"
agent_id = coder_agent.example.id
install_version = "1.0.1"
install_version = "4.8.3"
}
```

@ -62,6 +62,7 @@ for (const dir of dirs) {
let h1 = false;
let code = false;
let paragraph = false;
let version = false;
for (const token of tokens) {
if (token.type === "heading" && token.depth === 1) {
@ -77,6 +78,16 @@ for (const dir of dirs) {
}
if (token.type === "code") {
code = true;
if (token.lang !== "hcl") {
version = true;
continue;
}
let text = token.text;
// check if text contains version
if (text.includes("version")) {
version = true;
continue;
}
continue;
}
}
@ -89,6 +100,9 @@ for (const dir of dirs) {
if (!code) {
error(dir.name, "missing example code block after paragraph");
}
if (!version) {
error(dir.name, "missing version in code block");
}
}
if (badExit) {

@ -5,7 +5,7 @@
"fmt": "bun x prettier --plugin prettier-plugin-sh -w **/*.sh .sample/run.sh new.sh **/*.ts **/*.md *.md && terraform fmt **/*.tf .sample/main.tf",
"fmt:ci": "bun x prettier --plugin prettier-plugin-sh --check **/*.sh .sample/run.sh new.sh **/*.ts **/*.md *.md && terraform fmt -check **/*.tf .sample/main.tf",
"lint": "bun run lint.ts",
"update-version": "LATEST_TAG=$(git describe --abbrev=0 --tags | sed 's/^v//') && find . -name 'README.md' -exec sed -i \"s/version\\s*=\\s*\\\"[0-9]*\\.[0-9]*\\.[0-9]*\\\"/version = \\\"$LATEST_TAG\\\"/g\" {} \\;"
"update-version": "LATEST_TAG=$(git describe --abbrev=0 --tags | sed 's/^v//') && find . -name 'README.md' -exec sed -i \"s/\\( version \\s*=\\s*\\\"\\)[0-9]*\\.[0-9]*\\.[0-9]*\\(\\\"\\)/\\1$LATEST_TAG\\2/g\" {} \\;"
},
"devDependencies": {
"bun-types": "^1.0.18",

@ -73,6 +73,6 @@ module "vault" {
version = "1.0.1"
agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com"
vault_cli_version = "1.0.1"
vault_cli_version = "1.15.0"
}
```

Loading…
Cancel
Save