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

Dev: Create new lint, test, format, watcher scripts and tasks #1652

Merged
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
18 changes: 17 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"arglists",
"autoindent",
"Batsov",
"behaviour",
"bencode",
"betterthantomorrow",
"bhauman",
Expand All @@ -33,6 +34,7 @@
"cljify",
"cljslib",
"CLJSREPL",
"Clojuredocs",
"clojurians",
"Clojurists",
"cmdline",
Expand All @@ -58,6 +60,7 @@
"docmirror",
"Docstring",
"Dorg",
"doseq",
"dotimes",
"Dvlaaad",
"eckstein",
Expand Down Expand Up @@ -103,6 +106,7 @@
"jszip",
"junit",
"keywordize",
"keywordized",
"klepsch",
"kondo",
"lein",
Expand Down Expand Up @@ -201,5 +205,17 @@
"languageId": ["clojure", "json", "typescript"],
"allowCompoundWords": false
}
]
],
"githubIssues.issueBranchTitle": "wip/${user}/issue-#${issueNumber}/${sanitizedIssueTitle}",
"typescript.tsdk": "node_modules/typescript/lib",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"peacock.color": "#e48141"
}
135 changes: 134 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,140 @@
"kind": "build",
"isDefault": true
},
"problemMatcher": "$tsc-watch"
"problemMatcher": "$tsc-watch",
"presentation": {
"panel": "dedicated",
"group": "defaultCalva"
}
},
{
"label": "Calva Test Watch",
"type": "npm",
"script": "unit-test-watch",
"isBackground": true,
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": {
// "owner": "mocha",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": [
{
"regexp": "^not\\sok\\s\\d+\\s(.*)$"
},
{
"regexp": "\\s+(.*)$",
"message": 1
},
{
"regexp": "\\s+at\\s(.*)\\s\\((.*):(\\d+):(\\d+)\\)",
"file": 2,
"line": 3,
"column": 4
}
]
},
"presentation": {
"panel": "dedicated",
"group": "defaultCalva"
}
},
{
"label": "Calva Lint Watch",
"type": "npm",
"script": "eslint-watch",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": "$eslint-compact",
"presentation": {
"panel": "dedicated",
"group": "defaultCalva"
}
},
{
"label": "Calva Prettier Check Watch",
"type": "npm",
"script": "prettier-check-watch",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": [
{
"owner": "prettier",
"source": "prettier",
"fileLocation": ["relative", "${workspaceRoot}"],
"severity": "warning",
"pattern": {
"regexp": "\\[warn\\] (.+)",
"kind": "file",
"file": 1,
"message": 1
},
"background": {
"activeOnStart": true,
"beginsPattern": "Checking formatting",
"endsPattern": "(\\[warn\\] Code style issues found in the above file\\(s\\))|(All matched files use Prettier code style!)"
}
},
{
"owner": "prettier",
"source": "prettier",
"fileLocation": ["relative", "${workspaceRoot}"],
"severity": "error",
"pattern": {
"regexp": "\\[(error)\\] (.+?): (.+) \\((\\d+?):(\\d+?)\\)",
"kind": "location",
"severity": 1,
"file": 2,
"message": 3,
"line": 4,
"column": 5
},
"background": {
"activeOnStart": true,
"beginsPattern": "Checking formatting",
"endsPattern": "(\\[warn\\] Code style issues found in the above file\\(s\\))|(All matched files use Prettier code style!)"
}
}
],
"presentation": {
"panel": "dedicated",
"group": "defaultCalva"
}
},
{
"label": "Calva Prettier Format Watch",
"type": "npm",
"script": "prettier-format-watch",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": false
},

"presentation": {
"panel": "dedicated",
"group": "defaultCalva"
}
},
{
"label": "Calva Dev",
"group": {
"kind": "build",
"isDefault": false
},
"dependsOn": [
"Calva Watch",
"Calva Test Watch",
"Calva Lint Watch",
"Calva Prettier Format Watch"
]
}
]
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changes to Calva.

## [Unreleased]

- Maintenance: Create npm scripts for prettier format+check watching, and expose vsc tasks for watching unit tests, prettier format, eslint and a compound task to run them all in one go.

## [2.0.261] - 2022-04-01
- Fix: [Results doc gets in a bad state and does not update](https://github.com/BetterThanTomorrow/calva/issues/1509)
- Fix: [Indenting not working correctly in vectors starting with fn-like symbols](https://github.com/BetterThanTomorrow/calva/issues/1622)
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2694,9 +2694,12 @@
"calva-lib-test": "node ./out/cljs-lib/test/cljs-lib-tests.js",
"integration-test": "node ./out/extension-test/integration/runTests.js",
"unit-test": "npx mocha --require ts-node/register 'src/extension-test/unit/**/*-test.ts'",
"unit-test-watch": "npx mocha --watch --require ts-node/register 'src/extension-test/unit/**/*-test.ts'",
"publish": "bb publish.clj",
"prettier-format": "npx prettier --write './**/*.{ts,js,json}'",
"prettier-check": "npx prettier --check './**/*.{ts,js,json}'",
"prettier-check-watch": "npx onchange './**/*.{ts,js,json}' -- prettier --check {{changed}}",
"prettier-format-watch": "npx onchange './**/*.{ts,js,json}' -- prettier --write {{changed}}",
"eslint": "npx eslint . --ext .js,.jsx,.ts,.tsx",
"eslint-watch": "npx esw . --ext .js,.jsx,.ts,.tsx --watch"
},
Expand Down