-
Notifications
You must be signed in to change notification settings - Fork 0
Expand lint coverage to CLI and config files #104
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ program | |
| .command('sync') | ||
| .description('Sync Markdown files to DB') | ||
| .argument('<dir>', 'directory') | ||
| .action(async (dir) => { | ||
| .action(async (dir: string) => { | ||
| console.log(`Syncing from "${dir}"...`); | ||
| if (!fs.existsSync(dir)) { | ||
| console.error('Directory not found'); | ||
|
|
@@ -57,12 +57,17 @@ program | |
| console.log('Sync complete.'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| }); | ||
|
|
||
| interface ExportOptions { | ||
| format: string; | ||
| output: string; | ||
| } | ||
|
|
||
| program | ||
| .command('export') | ||
| .description('Export data (md, json, site)') | ||
| .option('-f, --format <format>', 'format', 'md') | ||
| .option('-o, --output <dir>', 'output directory', './export') | ||
| .action(async (options) => { | ||
| .action(async (options: ExportOptions) => { | ||
| const outDir = options.output; | ||
| if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true }); | ||
|
|
||
|
|
@@ -194,13 +199,18 @@ async function exportSite(outDir: string) { | |
| fs.writeFileSync(path.join(outDir, 'index.html'), html); | ||
| } | ||
|
|
||
| interface EntityCreateOptions { | ||
| type: string; | ||
| description?: string; | ||
| } | ||
|
|
||
| program | ||
| .command('entity-create') | ||
| .description('Create entity') | ||
| .argument('<name>') | ||
| .option('-t, --type <type>', 'type', 'concept') | ||
| .option('-d, --description <description>', 'description') | ||
| .action(async (name, options) => { | ||
| .action(async (name: string, options: EntityCreateOptions) => { | ||
| await ensureDb(); | ||
| try { | ||
| const entity = await repository.createEntity({ | ||
|
|
@@ -210,7 +220,7 @@ program | |
| }); | ||
| console.log(`Created: ${entity.name} [${entity.type}] (ID: ${entity.id})`); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } catch (err) { | ||
| console.error(`Failed to create entity: ${err}`); | ||
| console.error(`Failed to create entity: ${String(err)}`); | ||
| } | ||
| }); | ||
|
|
||
|
|
@@ -229,13 +239,17 @@ program | |
| } | ||
| }); | ||
|
|
||
| interface ClaimCreateOptions { | ||
| confidence: string; | ||
| } | ||
|
|
||
| program | ||
| .command('claim-create') | ||
| .description('Create claim for entity') | ||
| .argument('<entity-name>') | ||
| .argument('<statement>') | ||
| .option('-c, --confidence <confidence>', 'confidence', '1.0') | ||
| .action(async (entityName, statement, options) => { | ||
| .action(async (entityName: string, statement: string, options: ClaimCreateOptions) => { | ||
| await ensureDb(); | ||
| const entity = await repository.getEntityByName(entityName); | ||
| if (!entity || !entity.id) { | ||
|
|
@@ -250,7 +264,7 @@ program | |
| }); | ||
| console.log(`Claim added to ${entity.name}: ${claim.statement}`); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } catch (err) { | ||
| console.error(`Failed to create claim: ${err}`); | ||
| console.error(`Failed to create claim: ${String(err)}`); | ||
| } | ||
| }); | ||
|
|
||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is considered a best practice to avoid the use of any
consolemethods in JavaScript code that will run on the browser.NOTE: If your repository contains a server side project, you can add
"nodejs"to theenvironmentproperty of analyzer meta in.deepsource.toml.This will prevent this issue from getting raised.
Documentation for the analyzer meta can be found here.
Alternatively, you can silence this issue for your repository as shown here.
If a specific
consolecall is meant to stay for other reasons, you can add a skipcq comment to that line.This will inform other developers about the reason behind the log's presence, and prevent DeepSource from flagging it.