1
0
mirror of synced 2025-11-08 12:57:47 +00:00

feat: TS v4, tslint -> eslint, add cspell support (#240)

Update all dependencies, migrate from tslint (deprecated) to typescript-eslint, and add support for
cspell.

BREAKING CHANGE: migrated from tslint (deprecated) to eslint.
This commit is contained in:
Jason Dreyzehner
2020-09-01 19:13:25 -04:00
committed by GitHub
parent ab50e80ec8
commit 390041b510
31 changed files with 6526 additions and 4298 deletions

52
.vscode/debug-ts.js vendored
View File

@@ -1,52 +0,0 @@
'use strict';
const meow = require('meow');
const path = require('path');
const tsFile = getTSFile();
const jsFile = TS2JS(tsFile);
replaceCLIArg(tsFile, jsFile);
// Ava debugger
require('ava/profile');
/**
* get ts file path from CLI args
*
* @return string path
*/
function getTSFile() {
const cli = meow();
return cli.input[0];
}
/**
* get associated compiled js file path
*
* @param tsFile path
* @return string path
*/
function TS2JS(tsFile) {
const srcFolder = path.join(__dirname, '..', 'src');
const distFolder = path.join(__dirname, '..', 'build', 'main');
const tsPathObj = path.parse(tsFile);
return path.format({
dir: tsPathObj.dir.replace(srcFolder, distFolder),
ext: '.js',
name: tsPathObj.name,
root: tsPathObj.root
});
}
/**
* replace a value in CLI args
*
* @param search value to search
* @param replace value to replace
* @return void
*/
function replaceCLIArg(search, replace) {
process.argv[process.argv.indexOf(search)] = replace;
}

8
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,8 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"eamodio.gitlens",
"streetsidesoftware.code-spell-checker",
]
}

100
.vscode/launch.json vendored
View File

@@ -1,84 +1,44 @@
{
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "Debug Project",
// we test in `build` to make cleanup fast and easy
"cwd": "${workspaceFolder}/build",
// Replace this with your project root. If there are multiple, you can
// automatically run the currently visible file with: "program": ${file}"
"program": "${workspaceFolder}/src/cli/cli.ts",
// "args": ["--no-install"],
"outFiles": ["${workspaceFolder}/build/main/**/*.js"],
"skipFiles": [
"<node_internals>/**/*.js",
"${workspaceFolder}/node_modules/**/*.js"
],
"preLaunchTask": "npm: build",
"stopOnEntry": true,
"smartStep": true,
"runtimeArgs": ["--nolazy"],
"env": {
"TYPESCRIPT_STARTER_REPO_URL": "${workspaceFolder}"
},
"console": "externalTerminal"
},
"configurations": [
// To debug, make sure a *.spec.ts file is active in the editor, then run a configuration
{
"type": "node",
"request": "launch",
"name": "Debug Spec",
"program": "${workspaceRoot}/.vscode/debug-ts.js",
"args": ["${file}"],
"name": "Debug Active Spec",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/ava",
"runtimeArgs": ["debug", "--break", "--serial", "${file}"],
"port": 9229,
"outputCapture": "std",
"skipFiles": ["<node_internals>/**/*.js"],
// Consider using `npm run watch` or `yarn watch` for faster debugging
// "preLaunchTask": "npm: build",
// "smartStep": true,
"runtimeArgs": ["--nolazy"]
"preLaunchTask": "npm: build"
// "smartStep": true
},
{
// Use this one if you're already running `yarn watch`
"type": "node",
"request": "launch",
"name": "Debug Active Spec (no build)",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/ava",
"runtimeArgs": ["debug", "--break", "--serial", "${file}"],
"port": 9229,
"outputCapture": "std",
"skipFiles": ["<node_internals>/**/*.js"]
// "smartStep": true
},
// --- cut here ---
// TODO: Simpler test debugging option. Discussion:
// https://github.com/avajs/ava/issues/1505#issuecomment-370654427
// {
// "type": "node",
// "request": "launch",
// "name": "Debug Visible Compiled Spec",
// "program": "${file}",
// "outFiles": ["${workspaceFolder}/build/main/**/*.js"],
// "skipFiles": ["<node_internals>/**/*.js"],
// // Consider using `npm run watch` or `yarn watch` for faster debugging
// // "preLaunchTask": "npm: build",
// // "stopOnEntry": true,
// // "smartStep": true,
// "runtimeArgs": ["--nolazy"],
// "env": {
// "AVA_DEBUG_MODE": "1"
// }
// }
// CLI:
{
"type": "node",
"request": "launch",
"name": "Debug CLI Unit Tests",
"program": "${workspaceFolder}/node_modules/ava/profile.js",
"args": ["${workspaceFolder}/build/main/cli/tests/cli.unit.spec.js"],
"skipFiles": ["<node_internals>/**/*.js"],
// "preLaunchTask": "npm: build",
// "smartStep": true,
"runtimeArgs": ["--nolazy"]
},
{
"type": "node",
"request": "launch",
"name": "Debug CLI Integration Tests",
"program": "${workspaceFolder}/node_modules/ava/profile.js",
"args": [
"${workspaceFolder}/build/main/cli/tests/cli.integration.spec.js"
],
"skipFiles": ["<node_internals>/**/*.js"],
// "preLaunchTask": "npm: build",
// "smartStep": true,
"runtimeArgs": ["--nolazy"]
"name": "Try CLI",
"program": "${workspaceFolder}/bin/typescript-starter",
"cwd": "${workspaceFolder}/build",
"env": {
"TYPESCRIPT_STARTER_REPO_URL": "${workspaceFolder}"
},
"args": ["debug"],
"skipFiles": ["<node_internals>/**/*.js"]
}
]
}
}

View File

@@ -1,5 +1,7 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
// "typescript.implementationsCodeLens.enabled": true
// "typescript.referencesCodeLens.enabled": true
"cSpell.userWords": [], // only use words from .cspell.json
"cSpell.enabled": true,
"editor.formatOnSave": true,
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}