From c85706205c7a267cd800ad46de47ce6d1c745d4c Mon Sep 17 00:00:00 2001 From: Sergey Astapov Date: Mon, 8 Jul 2024 23:19:42 -0400 Subject: [PATCH] Fix lint --- ember-lazy-mount/ember-cli-build.js | 16 +--------- ember-lazy-mount/index.js | 2 +- ember-lazy-mount/package.json | 14 ++++----- ember-lazy-mount/testem.js | 8 ++--- package.json | 16 ++++------ pnpm-lock.yaml | 30 +++++++++++-------- test-app/.eslintrc.js | 3 ++ test-app/.template-lintrc.js | 9 +----- test-app/package.json | 8 +++-- .../integration/components/lazy-mount-test.js | 17 ++++++----- test-engine/config/environment.js | 4 +-- test-engine/ember-cli-build.js | 16 +--------- test-engine/index.js | 4 +-- test-engine/package.json | 16 +++------- 14 files changed, 63 insertions(+), 100 deletions(-) diff --git a/ember-lazy-mount/ember-cli-build.js b/ember-lazy-mount/ember-cli-build.js index 366cbe50..28e9e626 100644 --- a/ember-lazy-mount/ember-cli-build.js +++ b/ember-lazy-mount/ember-cli-build.js @@ -7,19 +7,5 @@ module.exports = function (defaults) { // Add options here }); - /* - This build file specifies the options for the dummy test app of this - addon, located in `/tests/dummy` - This build file does *not* influence how the addon or the app using it - behave. You most likely want to be modifying `./index.js` or app's build file - */ - - const { maybeEmbroider } = require('@embroider/test-setup'); - return maybeEmbroider(app, { - skipBabel: [ - { - package: 'qunit', - }, - ], - }); + return app.toTree(); }; diff --git a/ember-lazy-mount/index.js b/ember-lazy-mount/index.js index cdda271d..4feea820 100644 --- a/ember-lazy-mount/index.js +++ b/ember-lazy-mount/index.js @@ -6,5 +6,5 @@ module.exports = { // This is required to make the host lookup mechanism in ember-engines work // for the dummy app. // https://github.com/ember-engines/ember-engines/blob/039501dd70962565c54bb34da2e96b1019ae50e7/lib/utils/find-hosts-host.js#L11 - lazyLoading: {} + lazyLoading: {}, }; diff --git a/ember-lazy-mount/package.json b/ember-lazy-mount/package.json index d6d3bb51..bdf933ec 100644 --- a/ember-lazy-mount/package.json +++ b/ember-lazy-mount/package.json @@ -17,21 +17,21 @@ "test": "tests" }, "scripts": { - "build": "ember build", + "lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"", "lint:css": "stylelint \"**/*.css\"", - "lint:css:fix": "concurrently \"npm:lint:css -- --fix\"", + "lint:css:fix": "concurrently \"pnpm:lint:css -- --fix\"", + "lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"", "lint:hbs": "ember-template-lint .", - "lint:js": "eslint .", - "start": "ember serve", - "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"", - "test:all": "ember try:each" + "lint:hbs:fix": "ember-template-lint . --fix", + "lint:js": "eslint . --cache", + "lint:js:fix": "eslint . --fix" }, "dependencies": { - "@babel/core": "^7.24.7", "ember-cli-babel": "^8.2.0", "ember-cli-htmlbars": "^6.3.0" }, "devDependencies": { + "@babel/core": "^7.24.7", "@babel/eslint-parser": "^7.24.7", "@babel/plugin-proposal-decorators": "^7.24.7", "@ember/optional-features": "^2.1.0", diff --git a/ember-lazy-mount/testem.js b/ember-lazy-mount/testem.js index fd17fa97..b0604775 100644 --- a/ember-lazy-mount/testem.js +++ b/ember-lazy-mount/testem.js @@ -14,8 +14,8 @@ module.exports = { '--disable-software-rasterizer', '--mute-audio', '--remote-debugging-port=0', - '--window-size=1440,900' - ].filter(Boolean) - } - } + '--window-size=1440,900', + ].filter(Boolean), + }, + }, }; diff --git a/package.json b/package.json index 0a118fcd..b3fb88a0 100644 --- a/package.json +++ b/package.json @@ -6,25 +6,21 @@ "test-engine" ], "scripts": { - "build": "concurrently 'pnpm:build:*'", - "build:js": "rollup --config", - "build:types": "glint --declaration", "lint": "concurrently 'pnpm:lint:*(!fix)' --names 'lint:'", "lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'", "lint:js": "eslint . --cache", "lint:js:fix": "eslint . --fix", - "lint:types": "glint", "prepack": "concurrently 'pnpm:build:*'", - "start": "concurrently 'pnpm:start:*'", - "start:js": "rollup --config --watch --no-watch.clearScreen", - "start:types": "glint --declaration --watch", - "test": "echo 'A v2 addon does not have tests, run tests in test-app'" + "test": "pnpm --filter '*' test" }, - "publishConfig": { - "registry": "https://registry.npmjs.org" + "devDependencies": { + "concurrently": "^8.2.2" }, "packageManager": "pnpm@8.15.8", "volta": { "node": "18.20.4" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5ed32c20..04c2d5ca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,13 +6,14 @@ settings: importers: - .: {} + .: + devDependencies: + concurrently: + specifier: ^8.2.2 + version: 8.2.2 ember-lazy-mount: dependencies: - '@babel/core': - specifier: ^7.24.7 - version: 7.24.7 ember-cli-babel: specifier: ^8.2.0 version: 8.2.0(@babel/core@7.24.7) @@ -20,6 +21,9 @@ importers: specifier: ^6.3.0 version: 6.3.0 devDependencies: + '@babel/core': + specifier: ^7.24.7 + version: 7.24.7 '@babel/eslint-parser': specifier: ^7.24.7 version: 7.24.7(@babel/core@7.24.7)(eslint@8.57.0) @@ -125,6 +129,9 @@ importers: '@ember/test-helpers': specifier: ^3.3.0 version: 3.3.0(ember-source@5.10.0)(webpack@5.92.1) + '@embroider/test-setup': + specifier: ^4.0.0 + version: 4.0.0 '@glimmer/component': specifier: ^1.1.2 version: 1.1.2(@babel/core@7.24.7) @@ -194,9 +201,15 @@ importers: ember-source: specifier: ~5.10.0 version: 5.10.0(@glimmer/component@1.1.2)(rsvp@4.8.5)(webpack@5.92.1) + ember-source-channel-url: + specifier: ^3.0.0 + version: 3.0.0 ember-template-lint: specifier: ^6.0.0 version: 6.0.0 + ember-try: + specifier: ^3.0.0 + version: 3.0.0 ember-welcome-page: specifier: ^7.0.2 version: 7.0.2 @@ -369,15 +382,6 @@ importers: rsvp: specifier: ^4.8.5 version: 4.8.5 - stylelint: - specifier: ^15.11.0 - version: 15.11.0 - stylelint-config-standard: - specifier: ^34.0.0 - version: 34.0.0(stylelint@15.11.0) - stylelint-prettier: - specifier: ^4.1.0 - version: 4.1.0(prettier@3.3.2)(stylelint@15.11.0) webpack: specifier: ^5.92.1 version: 5.92.1 diff --git a/test-app/.eslintrc.js b/test-app/.eslintrc.js index 25ceaab4..0c355bea 100644 --- a/test-app/.eslintrc.js +++ b/test-app/.eslintrc.js @@ -51,6 +51,9 @@ module.exports = { // test files files: ['tests/**/*-test.{js,ts}'], extends: ['plugin:qunit/recommended'], + rules: { + 'qunit/require-expect': ['error', 'except-simple'], + }, }, ], }; diff --git a/test-app/.template-lintrc.js b/test-app/.template-lintrc.js index e5f7b6d1..f35f61c7 100644 --- a/test-app/.template-lintrc.js +++ b/test-app/.template-lintrc.js @@ -1,12 +1,5 @@ 'use strict'; module.exports = { - overrides: [ - { - files: '*.{js,ts}', - options: { - singleQuote: true, - }, - }, - ], + extends: 'recommended', }; diff --git a/test-app/package.json b/test-app/package.json index be22488b..1526c33a 100644 --- a/test-app/package.json +++ b/test-app/package.json @@ -21,8 +21,7 @@ "lint:js": "eslint . --cache", "lint:js:fix": "eslint . --fix", "start": "ember serve", - "test": "concurrently \"pnpm:lint\" \"pnpm:test:*\" --names \"lint,test:\"", - "test:ember": "ember test" + "test": "ember test" }, "devDependencies": { "@babel/core": "^7.24.7", @@ -31,6 +30,7 @@ "@ember/optional-features": "^2.1.0", "@ember/string": "^3.1.1", "@ember/test-helpers": "^3.3.0", + "@embroider/test-setup": "^4.0.0", "@glimmer/component": "^1.1.2", "@glimmer/tracking": "^1.1.2", "broccoli-asset-rev": "^3.0.0", @@ -47,14 +47,16 @@ "ember-cli-terser": "^4.0.2", "ember-engines": "^0.11.0", "ember-fetch": "^8.1.2", - "ember-load-initializers": "^2.1.2", "ember-lazy-mount": "workspace:*", + "ember-load-initializers": "^2.1.2", "ember-modifier": "^4.2.0", "ember-page-title": "^8.2.3", "ember-qunit": "^8.1.0", "ember-resolver": "^12.0.1", "ember-source": "~5.10.0", + "ember-source-channel-url": "^3.0.0", "ember-template-lint": "^6.0.0", + "ember-try": "^3.0.0", "ember-welcome-page": "^7.0.2", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", diff --git a/test-app/tests/integration/components/lazy-mount-test.js b/test-app/tests/integration/components/lazy-mount-test.js index 8c1320b0..00242a1b 100644 --- a/test-app/tests/integration/components/lazy-mount-test.js +++ b/test-app/tests/integration/components/lazy-mount-test.js @@ -1,3 +1,4 @@ +/* eslint-disable ember/no-runloop */ import { render, settled } from '@ember/test-helpers'; import { setupRenderingTest } from 'ember-qunit'; import { module, test } from 'qunit'; @@ -8,10 +9,10 @@ import Service from '@ember/service'; import hbs from 'htmlbars-inline-precompile'; -module('Integration | Component | lazy-mount', function(hooks) { +module('Integration | Component | lazy-mount', function (hooks) { setupRenderingTest(hooks); - hooks.beforeEach(function(assert) { + hooks.beforeEach(function (assert) { this.onError = () => assert.step('onError'); this.onLoad = () => assert.step('onLoad'); this.didLoad = () => assert.step('didLoad'); @@ -30,7 +31,7 @@ module('Integration | Component | lazy-mount', function(hooks) { {{/lazy-mount}} `; - test('it works', async function(assert) { + test('it works', async function (assert) { assert.expect(7); this.engineName = 'test-engine'; @@ -59,7 +60,7 @@ module('Integration | Component | lazy-mount', function(hooks) { assert.verifySteps([]); }); - test('it throws an error right away for a non-existing engine', async function(assert) { + test('it throws an error right away for a non-existing engine', async function (assert) { this.engineName = 'not-an-engine'; run(() => render(TEMPLATE)); @@ -68,18 +69,18 @@ module('Integration | Component | lazy-mount', function(hooks) { assert .dom() .hasText( - 'isLoading: false; error: Error: Assertion Failed: No bundle with name "not-an-engine" exists in the asset manifest.;' + 'isLoading: false; error: Error: Assertion Failed: No bundle with name "not-an-engine" exists in the asset manifest.;', ); assert.verifySteps(['onLoad', 'onError']); }); }); - test('it shows a loading state and an error', async function(assert) { + test('it shows a loading state and an error', async function (assert) { assert.expect(6); class AssetLoaderService extends Service { async loadBundle() { - await new Promise(resolve => schedule('afterRender', resolve)); + await new Promise((resolve) => schedule('afterRender', resolve)); throw new Error('something failed'); } } @@ -110,7 +111,7 @@ module('Integration | Component | lazy-mount', function(hooks) { .dom() .hasText( 'isLoading: false; error: Error: something failed;', - 'shows an error' + 'shows an error', ); }); }); diff --git a/test-engine/config/environment.js b/test-engine/config/environment.js index 839e3122..2e428185 100644 --- a/test-engine/config/environment.js +++ b/test-engine/config/environment.js @@ -1,9 +1,9 @@ 'use strict'; -module.exports = function(environment) { +module.exports = function (environment) { const ENV = { modulePrefix: 'test-engine', - environment + environment, }; return ENV; diff --git a/test-engine/ember-cli-build.js b/test-engine/ember-cli-build.js index 366cbe50..28e9e626 100644 --- a/test-engine/ember-cli-build.js +++ b/test-engine/ember-cli-build.js @@ -7,19 +7,5 @@ module.exports = function (defaults) { // Add options here }); - /* - This build file specifies the options for the dummy test app of this - addon, located in `/tests/dummy` - This build file does *not* influence how the addon or the app using it - behave. You most likely want to be modifying `./index.js` or app's build file - */ - - const { maybeEmbroider } = require('@embroider/test-setup'); - return maybeEmbroider(app, { - skipBabel: [ - { - package: 'qunit', - }, - ], - }); + return app.toTree(); }; diff --git a/test-engine/index.js b/test-engine/index.js index da31ad14..bd2c7b87 100644 --- a/test-engine/index.js +++ b/test-engine/index.js @@ -6,10 +6,10 @@ module.exports = buildEngine({ name: 'test-engine', lazyLoading: { - enabled: true + enabled: true, }, isDevelopingAddon() { return true; - } + }, }); diff --git a/test-engine/package.json b/test-engine/package.json index d15c7abd..3fc3985a 100644 --- a/test-engine/package.json +++ b/test-engine/package.json @@ -14,18 +14,13 @@ }, "scripts": { "build": "ember build --environment=production", - "lint": "concurrently \"yarn:lint:*(!fix)\" --names \"lint:\"", - "lint:css": "stylelint \"**/*.css\"", - "lint:css:fix": "concurrently \"yarn:lint:css -- --fix\"", - "lint:fix": "concurrently \"yarn:lint:*:fix\" --names \"fix:\"", + "lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"", + "lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"", "lint:hbs": "ember-template-lint .", "lint:hbs:fix": "ember-template-lint . --fix", "lint:js": "eslint . --cache", "lint:js:fix": "eslint . --fix", - "start": "ember serve", - "test": "concurrently \"yarn:lint\" \"yarn:test:*\" --names \"lint,test:\"", - "test:ember": "ember test", - "test:ember-compatibility": "ember try:each" + "start": "ember serve" }, "dependencies": { "@babel/core": "^7.24.7", @@ -33,7 +28,6 @@ "ember-cli-htmlbars": "^6.3.0" }, "devDependencies": { - "ember-engines": "^0.11.0", "@babel/eslint-parser": "^7.24.7", "@babel/plugin-proposal-decorators": "^7.24.7", "@ember/optional-features": "^2.1.0", @@ -50,6 +44,7 @@ "ember-cli-inject-live-reload": "^2.1.0", "ember-cli-sri": "^2.1.1", "ember-cli-terser": "^4.0.2", + "ember-engines": "^0.11.0", "ember-load-initializers": "^2.1.2", "ember-page-title": "^8.2.3", "ember-qunit": "^8.1.0", @@ -69,9 +64,6 @@ "qunit": "^2.21.0", "qunit-dom": "^3.2.0", "rsvp": "^4.8.5", - "stylelint": "^15.11.0", - "stylelint-config-standard": "^34.0.0", - "stylelint-prettier": "^4.1.0", "webpack": "^5.92.1" }, "peerDependencies": {