From a639d91663a483fe1df7d0bbb253a13ae2880aed Mon Sep 17 00:00:00 2001 From: Corentin Leruth Date: Tue, 2 Oct 2018 17:38:05 +0200 Subject: [PATCH 1/3] Show TSLint in "Linter/Formatter" when TypeScript selected --- packages/cli/lib/init.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/cli/lib/init.js b/packages/cli/lib/init.js index 89e77bf..fc52397 100644 --- a/packages/cli/lib/init.js +++ b/packages/cli/lib/init.js @@ -100,8 +100,11 @@ module.exports = function (type, dir, opts) { }, { name: 'linter', message: '(TODO) Which linter / formatter do you like?', - type: (_, all) => all.features.some(x => /linter-or-formatter/.test(x)) && 'select', - choices: toChoices(['None', 'ESLint', 'Prettier', 'TSLint']), + type: (_, all) => all.features.some(x => /linter-or-formatter/.test(x) || /typescript/.test(x)) && 'select', + choices: val => toChoices((!/typescript/.test(val) || /linter-or-formatter/.test(val) + ? ['None', 'ESLint', 'Prettier'] + : []) + .concat(['TSLint'])), format: val => val !== 'none' && val }, { name: 'sw', From 4a110407843bdafbddbcb12599610a4729989c28 Mon Sep 17 00:00:00 2001 From: Corentin Leruth Date: Tue, 2 Oct 2018 17:42:05 +0200 Subject: [PATCH 2/3] simplify logic --- packages/cli/lib/init.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/cli/lib/init.js b/packages/cli/lib/init.js index fc52397..79039e5 100644 --- a/packages/cli/lib/init.js +++ b/packages/cli/lib/init.js @@ -101,10 +101,7 @@ module.exports = function (type, dir, opts) { name: 'linter', message: '(TODO) Which linter / formatter do you like?', type: (_, all) => all.features.some(x => /linter-or-formatter/.test(x) || /typescript/.test(x)) && 'select', - choices: val => toChoices((!/typescript/.test(val) || /linter-or-formatter/.test(val) - ? ['None', 'ESLint', 'Prettier'] - : []) - .concat(['TSLint'])), + choices: val => toChoices((/linter-or-formatter/.test(val) ? ['None', 'ESLint', 'Prettier'] : []).concat(['TSLint'])), format: val => val !== 'none' && val }, { name: 'sw', From eb2ab6f7501b600496c22def5ca016bcbfe19614 Mon Sep 17 00:00:00 2001 From: Corentin Leruth Date: Tue, 2 Oct 2018 19:15:28 +0200 Subject: [PATCH 3/3] changed logic --- packages/cli/lib/init.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/cli/lib/init.js b/packages/cli/lib/init.js index 79039e5..fdfcfd3 100644 --- a/packages/cli/lib/init.js +++ b/packages/cli/lib/init.js @@ -100,8 +100,8 @@ module.exports = function (type, dir, opts) { }, { name: 'linter', message: '(TODO) Which linter / formatter do you like?', - type: (_, all) => all.features.some(x => /linter-or-formatter/.test(x) || /typescript/.test(x)) && 'select', - choices: val => toChoices((/linter-or-formatter/.test(val) ? ['None', 'ESLint', 'Prettier'] : []).concat(['TSLint'])), + type: (_, all) => all.features.some(x => /linter-or-formatter/.test(x)) && 'select', + choices: val => toChoices(['None', /typescript/.test(val) ? 'TSLint' : 'ESLint', 'Prettier']), format: val => val !== 'none' && val }, { name: 'sw',