Skip to content

Commit

Permalink
Bump to v1.0.6, bump vitest, mv {js,ts}config.json
Browse files Browse the repository at this point in the history
After doing more research, it appears tsconfig.json is more broadly
supported by editors and IDEs than jsconfig.json. For example, IntelliJ
IDEA/WebStorm won't recognize it unless added to Settings > Editor >
File Types > TypeScript.

After switching, the @types/chai dependency actually caused a conflict;
somehow the necessary types were found via vitest that weren't before. I
also had to add "WebWorker" to "compilerOptions.lib" in tsconfig.json.

Fixed the problems with vitest.config.js and ci/vitest.config.js such
that the `// @ts-nocheck` directive is no longer necessary. Moved a
bunch of compiler options from the `pnpm typecheck` script into
tsconfig.json.

Added the `rimraf` npm to make sure `pnpm prepack` generates a new
`types/` directory without stale content.

Bumped vitest to 1.2.0.

Finally, it seems IntelliJ IDEA's JSDoc type checking is stronger than
TypeScript and VSCode. Fixed a few JSDoc type parameters to eliminate
warnings in IntelliJ as well.
  • Loading branch information
mbland committed Jan 15, 2024
1 parent 197d421 commit e0d287d
Show file tree
Hide file tree
Showing 7 changed files with 334 additions and 189 deletions.
3 changes: 1 addition & 2 deletions ci/vitest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @ts-nocheck
import { defineConfig, mergeConfig } from 'vitest/config'
import baseConfig from '../vitest.config'
import baseConfig from '../vitest.config.js'

export default mergeConfig(baseConfig, defineConfig({
test: {
Expand Down
8 changes: 4 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const INSTALL_HINT = 'Run \'pnpm add [-g|-D] jsdoc\' ' +
* @param {EnvVars} env - environment variables, presumably process.env
* @param {string} platform - the process.platform string
* @returns {Promise<RunJsdocResults>} result of `jsdoc` execution
* @throws if `jsdoc` isn't found or can't execute
* @throws {(Error | string)} if `jsdoc` isn't found or can't execute
*/
export async function runJsdoc(argv, env, platform) {
/** @type {string} */
Expand Down Expand Up @@ -72,7 +72,7 @@ export const pathKey = platform => platform !== 'win32' ? 'PATH' : 'Path'
* @param {EnvVars} env - environment variables, presumably process.env
* @param {string} platform - the process.platform string
* @returns {Promise<string>} path to the command
* @throws if `jsdoc` isn't found
* @throws {string} if `jsdoc` isn't found
*/
export async function getPath(cmdName, env, platform) {
const pk = pathKey(platform)
Expand Down Expand Up @@ -177,7 +177,7 @@ export async function analyzeArgv(argv) {
* ```
*
* This function is necessary because the `jsdoc` command depends upon the
* extremely popular strip-json-comments npm. Otherwise analyzeArgs() would
* extremely popular strip-json-comments npm. Otherwise, analyzeArgs() would
* choke on config.json files containing comments.
*
* This implementation was inspired by strip-json-comments, but is a completely
Expand Down Expand Up @@ -225,7 +225,7 @@ export function stripJsonComments(str) {
* @param {string} dirname - current directory to search
* @param {string} filename - name of file to find
* @returns {Promise<string>} path to filename within dirname
* @throws if filename not found
* @throws {string} if filename not found
*/
export async function findFile(dirname, filename) {
const childDirs = [dirname]
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsdoc-cli-wrapper",
"version": "1.0.5",
"version": "1.0.6",
"description": "JSDoc command line interface wrapper",
"main": "index.js",
"bin": "./index.js",
Expand All @@ -9,9 +9,9 @@
"lint": "eslint --color --max-warnings 0 .",
"test": "vitest",
"test:ci": "pnpm lint && pnpm typecheck && vitest run -c ci/vitest.config.js && pnpm jsdoc",
"typecheck": "npx -p typescript tsc -p jsconfig.json --noEmit --pretty",
"jsdoc": "node index.js -c jsdoc.json .",
"prepack": "npx -p typescript tsc ./index.js --allowJs --declaration --declarationMap --emitDeclarationOnly --outDir types"
"typecheck": "npx tsc",
"prepack": "npx rimraf types && npx tsc ./index.js --allowJs --declaration --declarationMap --emitDeclarationOnly --outDir types"
},
"files": [
"lib/**",
Expand All @@ -25,23 +25,23 @@
"license": "MPL-2.0",
"type": "module",
"engines": {
"node": ">= 18.0.0"
"node": ">=18.0.0"
},
"homepage": "https://github.com/mbland/jsdoc-cli-wrapper",
"repository": "https://github.com/mbland/jsdoc-cli-wrapper",
"bugs": "https://github.com/mbland/jsdoc-cli-wrapper/issues",
"devDependencies": {
"@stylistic/eslint-plugin-js": "^1.5.3",
"@types/chai": "^4.3.11",
"@types/node": "^20.10.7",
"@vitest/coverage-istanbul": "^1.1.3",
"@vitest/coverage-v8": "^1.1.3",
"@vitest/ui": "^1.1.3",
"@types/node": "^20.11.3",
"@vitest/coverage-istanbul": "^1.2.0",
"@vitest/coverage-v8": "^1.2.0",
"@vitest/ui": "^1.2.0",
"eslint": "^8.56.0",
"eslint-plugin-jsdoc": "^46.10.1",
"eslint-plugin-vitest": "^0.3.20",
"jsdoc": "^4.0.2",
"rimraf": "^5.0.5",
"typescript": "^5.3.3",
"vitest": "^1.1.3"
"vitest": "^1.2.0"
}
}
Loading

0 comments on commit e0d287d

Please sign in to comment.