Skip to content

Commit

Permalink
Merge pull request #620 from buschtoens/lint
Browse files Browse the repository at this point in the history
Fix lint to make CI green
  • Loading branch information
SergeAstapov authored Jul 9, 2024
2 parents e4f16eb + c857062 commit 0d5ab68
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 100 deletions.
16 changes: 1 addition & 15 deletions ember-lazy-mount/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
2 changes: 1 addition & 1 deletion ember-lazy-mount/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
};
14 changes: 7 additions & 7 deletions ember-lazy-mount/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions ember-lazy-mount/testem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
},
};
16 changes: 6 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"volta": {
"node": "18.20.4"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
}
}
30 changes: 17 additions & 13 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions test-app/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ module.exports = {
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
rules: {
'qunit/require-expect': ['error', 'except-simple'],
},
},
],
};
9 changes: 1 addition & 8 deletions test-app/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
'use strict';

module.exports = {
overrides: [
{
files: '*.{js,ts}',
options: {
singleQuote: true,
},
},
],
extends: 'recommended',
};
8 changes: 5 additions & 3 deletions test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
17 changes: 9 additions & 8 deletions test-app/tests/integration/components/lazy-mount-test.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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');
Expand All @@ -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';
Expand Down Expand Up @@ -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));
Expand All @@ -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');
}
}
Expand Down Expand Up @@ -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',
);
});
});
4 changes: 2 additions & 2 deletions test-engine/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

module.exports = function(environment) {
module.exports = function (environment) {
const ENV = {
modulePrefix: 'test-engine',
environment
environment,
};

return ENV;
Expand Down
16 changes: 1 addition & 15 deletions test-engine/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
4 changes: 2 additions & 2 deletions test-engine/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ module.exports = buildEngine({
name: 'test-engine',

lazyLoading: {
enabled: true
enabled: true,
},

isDevelopingAddon() {
return true;
}
},
});
16 changes: 4 additions & 12 deletions test-engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,20 @@
},
"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",
"ember-cli-babel": "^8.2.0",
"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",
Expand All @@ -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",
Expand All @@ -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": {
Expand Down

0 comments on commit 0d5ab68

Please sign in to comment.