Skip to content

Commit

Permalink
Sync eslint & prettier in test-app-3.x (like in other test-apps…
Browse files Browse the repository at this point in the history
…) & fix test errors
  • Loading branch information
mkszepp committed Jun 27, 2024
1 parent 58f384c commit e752b4d
Show file tree
Hide file tree
Showing 18 changed files with 118 additions and 308 deletions.
278 changes: 21 additions & 257 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions test-app-3.x/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# unconventional js
/blueprints/*/files/

# compiled output
/declarations/
/dist/

# misc
/coverage/
!.*
.*/

# ember-try
/.node_modules.ember-try/
23 changes: 13 additions & 10 deletions test-app-3.x/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

module.exports = {
root: true,
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2018,
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
requireConfigFile: false,
babelOptions: {
plugins: [
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],
],
},
},
plugins: ['ember'],
Expand All @@ -26,31 +29,31 @@ module.exports = {
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.stylelintrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./lib/*/index.js',
'./server/**/*.js',
'./scenarios.js',
'./tests/.eslintrc.js',
],
excludedFiles: ['addon/**', 'addon-test-support/**', 'app/**'],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
extends: ['plugin:n/recommended'],
},
{
// Test files:
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
rules: {
'qunit/require-expect': 'off',
},
},
],
};
13 changes: 13 additions & 0 deletions test-app-3.x/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# unconventional js
/blueprints/*/files/

# compiled output
/dist/

# misc
/coverage/
!.*
.*/

# ember-try
/.node_modules.ember-try/
12 changes: 12 additions & 0 deletions test-app-3.x/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

module.exports = {
overrides: [
{
files: '*.{js,ts}',
options: {
singleQuote: true,
},
},
],
};
8 changes: 8 additions & 0 deletions test-app-3.x/.stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# unconventional files
/blueprints/*/files/

# compiled output
/dist/

# addons
/.node_modules.ember-try/
15 changes: 8 additions & 7 deletions test-app-3.x/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"test:ember": "ember test --test-port 0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.24.7",
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^2.6.0",
"@ember/string": "^3.1.1",
Expand Down Expand Up @@ -46,16 +47,16 @@
"ember-source-channel-url": "^3.0.0",
"ember-template-lint": "^3.15.0",
"ember-try": "^3.0.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-ember": "^10.5.8",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-qunit": "^6.2.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-ember": "^11.12.0",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-qunit": "^8.1.1",
"jquery": "^3.6.0",
"loader.js": "^4.7.0",
"moment-timezone": "^0.5.33",
"prettier": "^2.5.1",
"prettier": "^3.3.2",
"qunit": "^2.17.2",
"qunit-console-grouper": "^0.3.0",
"qunit-dom": "^1.6.0",
Expand Down
5 changes: 0 additions & 5 deletions test-app-3.x/tests/.eslintrc.js

This file was deleted.

12 changes: 6 additions & 6 deletions test-app-3.x/tests/integration/moment-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module('moment', function (hooks) {
});

await render(
hbs`{{moment-format (moment this.date this.inputFormat) this.outputFormat}}`
hbs`{{moment-format (moment this.date this.inputFormat) this.outputFormat}}`,
);
assert.dom(this.element).hasText('May 3, 2010');
});
Expand All @@ -57,7 +57,7 @@ module('moment', function (hooks) {

this.service.changeLocale('fr');
await render(
hbs`{{moment-format (moment this.date this.inputFormat) this.outputFormat}}`
hbs`{{moment-format (moment this.date this.inputFormat) this.outputFormat}}`,
);

assert.dom(this.element).hasText('mai 3, 2010');
Expand All @@ -68,7 +68,7 @@ module('moment', function (hooks) {
assert.expect(1);

this.service.on('localeChanged', function () {
assert.equal(moment.locale(), 'es');
assert.strictEqual(moment.locale(), 'es');
done();
});

Expand Down Expand Up @@ -98,7 +98,7 @@ module('moment', function (hooks) {

this.service.setLocale('fr');
await render(
hbs`{{moment-format (moment this.date this.inputFormat) this.outputFormat}}`
hbs`{{moment-format (moment this.date this.inputFormat) this.outputFormat}}`,
);

assert.dom(this.element).hasText('mai 3, 2010');
Expand All @@ -108,8 +108,8 @@ module('moment', function (hooks) {
assert.expect(2);

this.service.updateLocale('en', { week: { dow: 3 } });
assert.equal(moment().weekday(0).format('dddd'), 'Wednesday');
assert.strictEqual(moment().weekday(0).format('dddd'), 'Wednesday');
this.service.updateLocale('en', { week: { dow: 0 } });
assert.equal(moment().weekday(0).format('dddd'), 'Sunday');
assert.strictEqual(moment().weekday(0).format('dddd'), 'Sunday');
});
});
10 changes: 5 additions & 5 deletions test-app-3.x/tests/unit/helpers/is-between-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module('is-between', function (hooks) {
this.set('context', context);

await render(
hbs`{{is-between '2010-10-19' this.context.date precision='year'}}`
hbs`{{is-between '2010-10-19' this.context.date precision='year'}}`,
);
assert.dom(this.element).hasText('true');
});
Expand All @@ -52,7 +52,7 @@ module('is-between', function (hooks) {
this.set('context', context);

await render(
hbs`{{is-between '2010-10-19' this.context.date precision='year' inclusivity='()'}}`
hbs`{{is-between '2010-10-19' this.context.date precision='year' inclusivity='()'}}`,
);
assert.dom(this.element).hasText('false');
});
Expand All @@ -68,7 +68,7 @@ module('is-between', function (hooks) {
assert.expect(1);

await render(
hbs`{{is-between '2010-10-20' '2009-12-31' '2012-01-01' precision='year'}}`
hbs`{{is-between '2010-10-20' '2009-12-31' '2012-01-01' precision='year'}}`,
);
assert.dom(this.element).hasText('true');
});
Expand All @@ -77,7 +77,7 @@ module('is-between', function (hooks) {
assert.expect(1);

await render(
hbs`{{is-between '2016-10-30' '2016-10-30' '2016-12-30' inclusivity='[)'}}`
hbs`{{is-between '2016-10-30' '2016-10-30' '2016-12-30' inclusivity='[)'}}`,
);
assert.dom(this.element).hasText('true');
});
Expand All @@ -86,7 +86,7 @@ module('is-between', function (hooks) {
assert.expect(1);

await render(
hbs`{{is-between '2016-10-30' '2016-10-30' '2017-12-30' precision='year' inclusivity='[]'}}`
hbs`{{is-between '2016-10-30' '2016-10-30' '2017-12-30' precision='year' inclusivity='[]'}}`,
);
assert.dom(this.element).hasText('true');
});
Expand Down
2 changes: 1 addition & 1 deletion test-app-3.x/tests/unit/helpers/is-same-or-after-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module('is-same-or-after', function (hooks) {
assert.expect(1);

await render(
hbs`{{is-same-or-after '2010-12-20' '2010-10-19' precision='year'}}`
hbs`{{is-same-or-after '2010-12-20' '2010-10-19' precision='year'}}`,
);
assert.dom(this.element).hasText('true');
});
Expand Down
2 changes: 1 addition & 1 deletion test-app-3.x/tests/unit/helpers/is-same-or-before-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module('is-same-or-before', function (hooks) {
assert.expect(1);

await render(
hbs`{{is-same-or-before '2010-12-20' '2010-12-19' precision='year'}}`
hbs`{{is-same-or-before '2010-12-20' '2010-12-19' precision='year'}}`,
);
assert.dom(this.element).hasText('true');
});
Expand Down
16 changes: 8 additions & 8 deletions test-app-3.x/tests/unit/helpers/moment-calendar-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module('moment-calendar', function (hooks) {
});

await render(
hbs`{{moment-calendar this.date this.referenceDate timeZone='America/New_York'}}`
hbs`{{moment-calendar this.date this.referenceDate timeZone='America/New_York'}}`,
);
assert.dom(this.element).hasText('Yesterday at 9:30 PM');
});
Expand All @@ -54,7 +54,7 @@ module('moment-calendar', function (hooks) {
});

await render(
hbs`{{moment-calendar this.date this.referenceDate this.formats timeZone='America/New_York'}}`
hbs`{{moment-calendar this.date this.referenceDate this.formats timeZone='America/New_York'}}`,
);
assert.dom().hasText('Yesterday');
});
Expand All @@ -70,7 +70,7 @@ module('moment-calendar', function (hooks) {
});

await render(
hbs`{{moment-calendar this.date this.referenceDate lastDay=this.lastDay timeZone='America/New_York'}}`
hbs`{{moment-calendar this.date this.referenceDate lastDay=this.lastDay timeZone='America/New_York'}}`,
);
assert.dom(this.element).hasText('Yesterday!');
});
Expand All @@ -89,13 +89,13 @@ module('moment-calendar', function (hooks) {
});

await render(
hbs`{{moment-calendar this.date this.referenceDate this.formats lastDay='[YESTERDAY]' timeZone='America/New_York'}}`
hbs`{{moment-calendar this.date this.referenceDate this.formats lastDay='[YESTERDAY]' timeZone='America/New_York'}}`,
);

assert.equal(
assert.strictEqual(
Object.keys(this.formats).length,
2,
'formats object shape does not change'
'formats object shape does not change',
);
assert.dom(this.element).hasText('YESTERDAY');
});
Expand All @@ -110,7 +110,7 @@ module('moment-calendar', function (hooks) {
});

await render(
hbs`{{moment-calendar this.date this.referenceDate locale="es" timeZone='America/New_York'}}`
hbs`{{moment-calendar this.date this.referenceDate locale="es" timeZone='America/New_York'}}`,
);
assert.dom(this.element).hasText('hoy a las 3:30');
});
Expand All @@ -125,7 +125,7 @@ module('moment-calendar', function (hooks) {
});

await render(
hbs`{{moment-calendar this.date this.referenceDate timeZone='Australia/Sydney'}}`
hbs`{{moment-calendar this.date this.referenceDate timeZone='Australia/Sydney'}}`,
);

assert
Expand Down
2 changes: 1 addition & 1 deletion test-app-3.x/tests/unit/helpers/moment-diff-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module('moment-diff', function (hooks) {
});

await render(
hbs`{{moment-diff this.dateA this.dateB precision='year' float=true}}`
hbs`{{moment-diff this.dateA this.dateB precision='year' float=true}}`,
);
assert.dom().containsText('.5'); // good ol' rounding error
});
Expand Down
6 changes: 3 additions & 3 deletions test-app-3.x/tests/unit/helpers/moment-format-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module('moment-format', function (hooks) {
});

await render(
hbs`{{moment-format this.date this.outputFormat this.inputFormat}}`
hbs`{{moment-format this.date this.outputFormat this.inputFormat}}`,
);
assert.dom(this.element).hasText('May 3, 2010');
});
Expand Down Expand Up @@ -101,7 +101,7 @@ module('moment-format', function (hooks) {

this.set('date', 0);
await render(
hbs`{{moment-format this.date 'LLLL' timeZone='America/New_York'}}`
hbs`{{moment-format this.date 'LLLL' timeZone='America/New_York'}}`,
);
assert.dom(this.element).hasText('Wednesday, December 31, 1969 7:00 PM');
});
Expand All @@ -111,7 +111,7 @@ module('moment-format', function (hooks) {

this.set('date', 0);
await render(
hbs`{{moment-format this.date 'LLLL' timeZone='America/Los_Angeles'}}`
hbs`{{moment-format this.date 'LLLL' timeZone='America/Los_Angeles'}}`,
);
assert.dom(this.element).hasText('Wednesday, December 31, 1969 4:00 PM');
});
Expand Down
2 changes: 1 addition & 1 deletion test-app-3.x/tests/unit/helpers/moment-subtract-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module('moment-subtract', function (hooks) {
.format('ddd MMM DD YYYY');

await render(
hbs`{{moment-subtract '2016-06-01' this.number precision='days'}}`
hbs`{{moment-subtract '2016-06-01' this.number precision='days'}}`,
);
assert.dom().containsText(expectedString);
});
Expand Down
2 changes: 1 addition & 1 deletion test-app-3.x/tests/unit/helpers/unix-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module('unix', function (hooks) {
assert.expect(1);

await render(
hbs`{{moment-format (unix 946684799) 'YYYYMMDD' timeZone='America/Los_Angeles'}}`
hbs`{{moment-format (unix 946684799) 'YYYYMMDD' timeZone='America/Los_Angeles'}}`,
);
assert.dom(this.element).hasText('19991231');
});
Expand Down
4 changes: 2 additions & 2 deletions test-app-3.x/tests/unit/helpers/utc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ module('utc', function (hooks) {
const utcValue = momentService.utc(utcTimeStr, fmtStr);
this.set('utcValue', utcValue);
await render(
hbs`{{moment-format (utc this.estValue) 'YYYY-MM-DDTHH:mm:ss Z'}}`
hbs`{{moment-format (utc this.estValue) 'YYYY-MM-DDTHH:mm:ss Z'}}`,
);
assert.dom(this.element).hasText(utcTimeStr);

await render(
hbs`{{moment-format (utc this.utcValue) 'YYYY-MM-DDTHH:mm:ss Z'}}`
hbs`{{moment-format (utc this.utcValue) 'YYYY-MM-DDTHH:mm:ss Z'}}`,
);
assert.dom(this.element).hasText(utcTimeStr);
});
Expand Down

0 comments on commit e752b4d

Please sign in to comment.