From 39a2705e51b4b6329a70f91f8293a2d7a363bf5d Mon Sep 17 00:00:00 2001 From: "Benjamin E. Coe" Date: Mon, 30 Mar 2020 19:40:38 -0700 Subject: [PATCH] feat!: prefer single quotes if possible (#475) --- .eslintrc.json | 3 ++- src/clean.ts | 4 ++-- src/init.ts | 8 ++++---- test/test-init.ts | 24 ++++++++++++------------ 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 9dcc30f8..e6e2e426 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -16,7 +16,8 @@ "prefer-const": "error", "eol-last": "error", "prefer-arrow-callback": "error", - "no-trailing-spaces": "error" + "no-trailing-spaces": "error", + "quotes": ["warn", "single", { "avoidEscape": true }] }, "overrides": [ { diff --git a/src/clean.ts b/src/clean.ts index d711749f..b71be1ea 100644 --- a/src/clean.ts +++ b/src/clean.ts @@ -33,7 +33,7 @@ export async function clean(options: Options): Promise { if (outDir === '.') { options.logger.error( `${chalk.red('ERROR:')} ${chalk.gray('compilerOptions.outDir')} ` + - `cannot use the value '.'. That would delete all of our sources.` + 'cannot use the value ".". That would delete all of our sources.' ); return false; } @@ -45,7 +45,7 @@ export async function clean(options: Options): Promise { options.logger.error( `${chalk.red('ERROR:')} The ${chalk.gray('clean')} command` + ` requires ${chalk.gray('compilerOptions.outDir')} to be defined in ` + - `tsconfig.json.` + 'tsconfig.json.' ); return false; } diff --git a/src/init.ts b/src/init.ts index 389e0337..14294410 100644 --- a/src/init.ts +++ b/src/init.ts @@ -82,10 +82,10 @@ export async function addScripts( let edits = false; const pkgManager = getPkgManagerCommand(options.yarn); const scripts: Bag = { - check: `gts check`, + check: 'gts check', clean: 'gts clean', - compile: `tsc`, - fix: `gts fix`, + compile: 'tsc', + fix: 'gts fix', prepare: `${pkgManager} run compile`, pretest: `${pkgManager} run compile`, posttest: `${pkgManager} run check`, @@ -285,7 +285,7 @@ export async function init(options: Options): Promise { } const generate = await query( `${chalk.bold('package.json')} does not exist.`, - `Generate`, + 'Generate', true, options ); diff --git a/test/test-init.ts b/test/test-init.ts index 9766e45a..35036d7b 100644 --- a/test/test-init.ts +++ b/test/test-init.ts @@ -84,13 +84,13 @@ describe('init', () => { it('addScripts should not edit existing scripts on no', async () => { const SCRIPTS = { - check: `fake check`, + check: 'fake check', clean: 'fake clean', - compile: `fake tsc`, - fix: `fake fix`, - prepare: `fake run compile`, - pretest: `fake run compile`, - posttest: `fake run check`, + compile: 'fake tsc', + fix: 'fake fix', + prepare: 'fake run compile', + pretest: 'fake run compile', + posttest: 'fake run check', }; const pkg: PackageJson = { ...MINIMAL_PACKAGE_JSON, @@ -103,13 +103,13 @@ describe('init', () => { it('addScripts should edit existing scripts on yes', async () => { const SCRIPTS = { - check: `fake check`, + check: 'fake check', clean: 'fake clean', - compile: `fake tsc`, - fix: `fake fix`, - prepare: `fake run compile`, - pretest: `fake run compile`, - posttest: `fake run check`, + compile: 'fake tsc', + fix: 'fake fix', + prepare: 'fake run compile', + pretest: 'fake run compile', + posttest: 'fake run check', }; const pkg: PackageJson = { ...MINIMAL_PACKAGE_JSON,