Skip to content
Open
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
11 changes: 11 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ const getFullConfig = async ({
__NAME__: NAME,
__CONFIG_KEY__: CONFIG_KEY,
__VERSION__: LATEST_VERSION,
jsdoc: pkgConfig.jsdoc,
}

if (!pkgConfig.eslint && Array.isArray(pkgConfig.requiredPackages?.devDependencies)) {
Expand Down Expand Up @@ -240,6 +241,16 @@ const getFullConfig = async ({
])
}

if (pkgConfig.jsdoc) {
defaultsDeep(pkgConfig, { requiredPackages: { devDependencies: [] } })
pkgConfig.requiredPackages.devDependencies = uniq([
...pkgConfig.requiredPackages.devDependencies,
'typescript',
'@typescript-eslint/parser',
'@types/node'
])
}

const gitUrl = await git.getUrl(rootPkg.path)
if (gitUrl) {
derived.repository = {
Expand Down
3 changes: 3 additions & 0 deletions lib/content/eslintrc-js.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ module.exports = {
},
},
{{/if}}
{{#if jsdoc}}
parser: '@typescript-eslint/parser',
{{/if}}
extends: [
'@npmcli',
...localConfigs,
Expand Down
2 changes: 1 addition & 1 deletion lib/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const sharedRootAdd = name => ({
},
'tsconfig.json': {
file: 'tsconfig-json.hbs',
filter: p => p.config.typescript,
filter: p => p.config.typescript || p.config.jsdoc,
parser: p => p.JsonMergeNoComment,
},
// this lint commits which is only necessary for releases
Expand Down
20 changes: 20 additions & 0 deletions lib/content/tsconfig-json.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
{{#if jsdoc}}
{
"compilerOptions": {
"target": "ES2022",
"module": "node16",
"allowJs": true,
"checkJs": true,
"declaration": true,
"emitDeclarationOnly": true,
"strict": true,
"moduleResolution": "node16",
"esModuleInterop": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"types": ["node"]
},
"include": ["lib/**/*.js", "lib/**/*.ts"]
}
{{else}}
{
"compilerOptions": {
"jsx": "react",
Expand All @@ -15,3 +34,4 @@
"module": "nodenext"
}
}
{{/if}}
Loading