From 17110f62d81a51b613fd18f682c9e73450f7aecb Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Tue, 18 Apr 2023 12:05:19 -0400 Subject: [PATCH] Use overrides for better multi-file-format control of prettier --- .prettierrc.js | 13 ++++++++++--- test-packages/sample-transforms/.travis.yml | 10 +++++----- .../tests/dummy/app/templates/application.hbs | 2 +- tests/addon-template/.prettierrc.js | 9 ++++++++- .../tests/dummy/app/templates/application.hbs | 4 ++-- tests/app-template/.prettierrc.js | 12 ++++++++++++ tests/app-template/config/targets.js | 6 +++++- tests/ts-app-template/app/templates/application.hbs | 2 +- 8 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 tests/app-template/.prettierrc.js diff --git a/.prettierrc.js b/.prettierrc.js index b93d0458d..022b3141d 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,8 +1,15 @@ 'use strict'; module.exports = { - singleQuote: true, - trailingComma: 'es5', printWidth: 120, - arrowParens: 'avoid', + overrides: [ + { + files: '*{js,ts}', + options: { + trailingComma: 'es5', + arrowParens: 'avoid', + singleQuote: true, + }, + }, + ], }; diff --git a/test-packages/sample-transforms/.travis.yml b/test-packages/sample-transforms/.travis.yml index 544b700fc..94540c75d 100644 --- a/test-packages/sample-transforms/.travis.yml +++ b/test-packages/sample-transforms/.travis.yml @@ -3,7 +3,7 @@ language: node_js node_js: # we recommend testing addons with the same minimum supported node version as Ember CLI # so that your addon works for all apps - - '8' + - "8" sudo: false dist: trusty @@ -33,8 +33,8 @@ jobs: include: # runs linting and tests with current locked deps - - stage: 'Tests' - name: 'Tests' + - stage: "Tests" + name: "Tests" install: - yarn install --non-interactive script: @@ -42,13 +42,13 @@ jobs: - yarn lint:js - yarn test - - name: 'Floating Dependencies' + - name: "Floating Dependencies" script: - yarn test # we recommend new addons test the current and previous LTS # as well as latest stable release (bonus points to beta/canary) - - stage: 'Additional Tests' + - stage: "Additional Tests" env: EMBER_TRY_SCENARIO=ember-lts-2.18 - env: EMBER_TRY_SCENARIO=ember-lts-3.4 - env: EMBER_TRY_SCENARIO=ember-release diff --git a/test-packages/sample-transforms/tests/dummy/app/templates/application.hbs b/test-packages/sample-transforms/tests/dummy/app/templates/application.hbs index 9d5488550..5230580f8 100644 --- a/test-packages/sample-transforms/tests/dummy/app/templates/application.hbs +++ b/test-packages/sample-transforms/tests/dummy/app/templates/application.hbs @@ -1,3 +1,3 @@ -

Welcome to Ember

+

Welcome to Ember

{{outlet}} \ No newline at end of file diff --git a/tests/addon-template/.prettierrc.js b/tests/addon-template/.prettierrc.js index 534e6d35a..52881f37e 100644 --- a/tests/addon-template/.prettierrc.js +++ b/tests/addon-template/.prettierrc.js @@ -1,5 +1,12 @@ 'use strict'; module.exports = { - singleQuote: true, + overrides: [ + { + files: '*{js,ts}', + options: { + singleQuote: true, + }, + }, + ], }; diff --git a/tests/addon-template/tests/dummy/app/templates/application.hbs b/tests/addon-template/tests/dummy/app/templates/application.hbs index 17def5e6b..1001d149e 100644 --- a/tests/addon-template/tests/dummy/app/templates/application.hbs +++ b/tests/addon-template/tests/dummy/app/templates/application.hbs @@ -1,5 +1,5 @@ -{{page-title 'Dummy'}} +{{page-title "Dummy"}} -

Welcome to Ember

+

Welcome to Ember

{{outlet}} \ No newline at end of file diff --git a/tests/app-template/.prettierrc.js b/tests/app-template/.prettierrc.js new file mode 100644 index 000000000..52881f37e --- /dev/null +++ b/tests/app-template/.prettierrc.js @@ -0,0 +1,12 @@ +'use strict'; + +module.exports = { + overrides: [ + { + files: '*{js,ts}', + options: { + singleQuote: true, + }, + }, + ], +}; diff --git a/tests/app-template/config/targets.js b/tests/app-template/config/targets.js index 9f6cc6396..1e48e0599 100644 --- a/tests/app-template/config/targets.js +++ b/tests/app-template/config/targets.js @@ -1,6 +1,10 @@ 'use strict'; -const browsers = ['last 1 Chrome versions', 'last 1 Firefox versions', 'last 1 Safari versions']; +const browsers = [ + 'last 1 Chrome versions', + 'last 1 Firefox versions', + 'last 1 Safari versions', +]; module.exports = { browsers, diff --git a/tests/ts-app-template/app/templates/application.hbs b/tests/ts-app-template/app/templates/application.hbs index 82d8c07eb..1a5bac26b 100644 --- a/tests/ts-app-template/app/templates/application.hbs +++ b/tests/ts-app-template/app/templates/application.hbs @@ -1,3 +1,3 @@ -{{page-title 'TsAppTemplate'}} +{{page-title "TsAppTemplate"}} {{outlet}} \ No newline at end of file