Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 4d0cb1f

Browse files
authored
Merge pull request #752 from derrabauke/octane-pr-23
chore(lint): configure linting for gradual code adaption
2 parents 3fed5c6 + e169616 commit 4d0cb1f

File tree

21 files changed

+99
-44
lines changed

21 files changed

+99
-44
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@
2020
/.node_modules.ember-try/
2121
/bower.json.ember-try
2222
/package.json.ember-try
23+
24+
# template lint ci config
25+
.template-lintrc-ci.js

.eslintrc.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
module.exports = {
44
extends: ["@adfinis-sygroup/eslint-config/ember-app"],
55
rules: {
6+
"ember/no-actions-hash": "warn",
7+
"ember/no-component-lifecycle-hooks": "warn",
68
"ember/no-mixins": "warn",
79
"ember/no-new-mixins": "warn",
810
"ember/no-classic-classes": "warn",
11+
"ember/no-classic-components": "warn",
912
"ember/no-get": "warn",
1013
"ember/no-observers": "warn",
1114
"qunit/no-assert-equal": "warn",
15+
"ember/require-tagless-components": "warn",
1216
},
1317
};

.template-lintrc-ci.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"use strict";
2+
3+
module.exports = {
4+
extends: "recommended",
5+
rules: {
6+
// following rules are for temporary use only, delete when ember 4.0 ready
7+
"no-action": "warn",
8+
"no-curly-component-invocation": "warn",
9+
"no-duplicate-id": "warn",
10+
"no-link-to-positional-params": "warn",
11+
"no-link-to-tagname": "warn",
12+
"no-invalid-interactive": "warn",
13+
"no-implicit-this": "warn",
14+
"no-passed-in-event-handlers": "warn",
15+
"no-positional-data-test-selectors": "warn",
16+
"no-unknown-arguments-for-builtin-components": "warn",
17+
"no-with": "warn",
18+
"no-yield-only": "warn",
19+
"require-input-label": "warn",
20+
"require-has-block-helper": "warn",
21+
},
22+
};

app/abilities/report.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Ability } from "ember-can";
33

44
export default Ability.extend({
55
canEdit: computed(
6+
// eslint-disable-next-line ember/use-brace-expansion
67
"model.user.{id,supervisors}",
78
"model.verifiedBy.id",
89
"model.{billed,customerAssignees,projectAssignees,taskAssignees}",

app/components/attendance-slider/component.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
* @public
55
*/
66

7-
import Component from "@glimmer/component";
87
import { htmlSafe } from "@ember/string";
8+
import Component from "@glimmer/component";
9+
import { tracked } from "@glimmer/tracking";
10+
import { dropTask } from "ember-concurrency";
911
import { padStartTpl } from "ember-pad/utils/pad";
1012
import moment from "moment";
1113
import formatDuration from "timed/utils/format-duration";
12-
import { tracked } from "@glimmer/tracking";
13-
import { dropTask } from "ember-concurrency";
1414

1515
const padTpl2 = padStartTpl(2);
1616

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
Per page:
2-
{{#each this.limits as |l i|}}
2+
{{#each this.limits as |l|}}
33
<span>
44
{{#if (eq this.page_size l)}}
55
{{l}}
66
{{else}}
7-
<a href="#" {{action (queue (action (mut this.page) 1) (action (mut this.page_size) l))}}>{{l}}</a>
7+
<a
8+
href="#"
9+
{{action
10+
(queue (action (mut this.page) 1) (action (mut this.page_size) l))
11+
}}
12+
>{{l}}</a>
813
{{/if}}
914
</span>
10-
{{/each}}
15+
{{/each}}

app/components/sy-timepicker/template.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
maxlength={{this.maxlength}}
88
placeholder={{this.placeholder}}
99
autocomplete="off"
10+
{{!template-lint-disable no-down-event-binding}}
1011
{{on "keydown" this.keyDown}}
1112
{{on "change" this.change}}
1213
{{on "focusout" (optional @onFocusOut)}}

app/components/user-selection/component.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import { inject as service } from "@ember/service";
22
import Component from "@glimmer/component";
33
import { tracked } from "@glimmer/tracking";
4-
import { trackedTask } from "ember-resources/util/ember-concurrency";
54
import { restartableTask } from "ember-concurrency";
6-
7-
import customSelectedTemplate from "timed/components/optimized-power-select/custom-select/user-selection";
5+
import { trackedTask } from "ember-resources/util/ember-concurrency";
86
import customOptionTemplate from "timed/components/optimized-power-select/custom-options/user-option";
7+
import customSelectedTemplate from "timed/components/optimized-power-select/custom-select/user-selection";
98

109
export default class UserSelection extends Component {
1110
selectedTemplate = customSelectedTemplate;

app/components/welcome-modal/template.hbs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<SyModal @visible={{this.visible}} as |modal|>
22
<modal.body>
3-
<div class="text-center">
3+
<div class="text-center welcome-modal-body">
44
<h1>Welcome to Timed!</h1>
5-
<img style="max-width:50%" src="/assets/logo.svg">
5+
<img class="logo" src="/assets/logo.svg" alt="timed" />
66
<h4>Would you like to take a tour?</h4>
77
</div>
88
</modal.body>
@@ -12,23 +12,26 @@
1212
type="button"
1313
class="btn btn-never"
1414
data-test-tour-never
15-
{{action this.on-never}}>
15+
{{action this.on-never}}
16+
>
1617
Never
1718
</button>
1819

1920
<button
2021
type="button"
2122
class="btn btn-default"
2223
data-test-tour-later
23-
{{action this.on-later}}>
24+
{{action this.on-later}}
25+
>
2426
Later
2527
</button>
2628

2729
<button
2830
type="submit"
2931
class="btn btn-primary"
3032
data-test-tour-start
31-
{{action this.on-start}}>
33+
{{action this.on-start}}
34+
>
3235
Sure
3336
</button>
3437
</modal.footer>

app/index/template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
{{/each}}
226226
</div>
227227
</f.input>
228-
<f.input @name="dates" as |fi|>
228+
<f.input @name="dates">
229229
<PowerCalendarMultiple
230230
class="calendar"
231231
@selected={{changeset.dates}}

app/models/task.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* @public
55
*/
66
import Model, { attr, belongsTo, hasMany } from "@ember-data/model";
7+
import { get } from "@ember/object";
78

89
/**
910
* The task model
@@ -73,8 +74,8 @@ export default class Task extends Model {
7374

7475
get longName() {
7576
const taskName = this.name;
76-
const projectName = this.get("project.name");
77-
const customerName = this.get("project.customer.name");
77+
const projectName = get(this, "project.name");
78+
const customerName = get(this, "project.customer.name");
7879

7980
return `${customerName} > ${projectName} > ${taskName}`;
8081
}

app/statistics/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import Route from "@ember/routing/route";
22

3-
export default class StatisticsRoute extends Route{};
3+
export default class StatisticsRoute extends Route {}

app/styles/app.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
@import "components/sy-datepicker";
3434
@import "components/attendance-slider";
3535
@import "components/statistic-list-bar";
36+
@import "components/welcome-modal";
3637

3738
html {
3839
hyphens: auto;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.welcome-modal-body {
2+
.logo {
3+
max-width: 50%;
4+
}
5+
}

app/users/edit/index/template.hbs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,22 @@
2020
</tr>
2121
<tr>
2222
<td>Contract type:</td>
23-
<td>{{if this.model.activeEmployment.isExternal "External" "Internal"}}</td>
23+
<td>{{if
24+
this.model.activeEmployment.isExternal
25+
"External"
26+
"Internal"
27+
}}</td>
2428
</tr>
2529
<tr>
2630
<td>Percentage:</td>
2731
<td>{{this.model.activeEmployment.percentage}}%</td>
2832
</tr>
2933
<tr>
3034
<td>Worktime:</td>
31-
<td>{{humanize-duration this.model.activeEmployment.worktimePerDay false}}</td>
35+
<td>{{humanize-duration
36+
this.model.activeEmployment.worktimePerDay
37+
false
38+
}}</td>
3239
</tr>
3340
{{/if}}
3441
</tbody>
@@ -61,16 +68,20 @@
6168
<tr>
6269
<td>{{employment.location.name}}</td>
6370
<td>{{employment.percentage}}%</td>
64-
<td>{{moment-format employment.start 'DD.MM.YYYY'}}</td>
65-
<td>{{if employment.end (moment-format employment.end 'DD.MM.YYYY') '-'}}</td>
71+
<td>{{moment-format employment.start "DD.MM.YYYY"}}</td>
72+
<td>{{if
73+
employment.end
74+
(moment-format employment.end "DD.MM.YYYY")
75+
"-"
76+
}}</td>
6677
</tr>
6778
{{/each}}
6879
</tbody>
6980
</table>
70-
{{^}}
81+
{{else}}
7182
<div class="card-block empty">
7283
<div>
73-
{{fa-icon 'briefcase'}}
84+
{{fa-icon "briefcase"}}
7485
<p>
7586
No employments found...
7687
</p>
@@ -101,19 +112,19 @@
101112
</tr>
102113
</thead>
103114
<tbody>
104-
{{#each absences as |absence index|}}
115+
{{#each absences as |absence|}}
105116
<tr>
106117
<td>{{absence.absenceType.name}}</td>
107-
<td>{{moment-format absence.date 'DD.MM.YYYY'}}</td>
118+
<td>{{moment-format absence.date "DD.MM.YYYY"}}</td>
108119
<td>{{absence.comment}}</td>
109120
</tr>
110121
{{/each}}
111122
</tbody>
112123
</table>
113-
{{^}}
124+
{{else}}
114125
<div class="card-block empty">
115126
<div>
116-
{{fa-icon 'calendar-times-o'}}
127+
{{fa-icon "calendar-times-o"}}
117128
<p>
118129
No absences found...
119130
</p>

config/targets.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
"use-strict";
22

33
module.exports = {
4-
browsers: ["last 2 Firefox versions", "last 2 Chrome versions"],
4+
browsers: [
5+
"last 2 Firefox versions",
6+
"last 2 Chrome versions",
7+
"last 1 Safari versions",
8+
],
59
};

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
"build": "ember build --environment=production",
1414
"lint": "npm-run-all --aggregate-output --continue-on-error --parallel \"lint:!(fix)\"",
1515
"lint:fix": "npm-run-all --aggregate-output --continue-on-error --parallel lint:*:fix",
16-
"lint:hbs": "ember-template-lint .",
16+
"lint:hbs": "ember-template-lint . --config-path .template-lintrc-ci.js",
1717
"lint:hbs:fix": "ember-template-lint . --fix",
18-
"lint:js": "eslint . --cache",
18+
"lint:js": "eslint --config .eslintrc.js .",
19+
"lint:js:fix": "eslint --config .eslintrc.js . --fix",
1920
"prepare": "husky install",
2021
"preinstall": "npx only-allow pnpm",
2122
"lint:js:fix": "eslint . --fix",
@@ -29,7 +30,7 @@
2930
]
3031
},
3132
"lint-staged": {
32-
"*.js": "eslint --cache --fix",
33+
"*.js": "eslint --config .eslintrc.js --cache --fix",
3334
"*.hbs": "ember-template-lint --fix",
3435
"*.{scss,graphql,json,md,yml}": "prettier --write"
3536
},

testem.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = {
55
disable_watching: true,
66
parallel: -1,
77
launch_in_dev: [],
8-
launch_in_ci: ["chrome", "firefox"],
8+
launch_in_ci: ["chrome"],
99
browser_start_timeout: 120,
1010
browser_args: {
1111
Chrome: {
@@ -20,7 +20,6 @@ module.exports = {
2020
"--remote-debugging-port=9222",
2121
"--window-size=1440,900",
2222
].filter(Boolean),
23-
firefox: ["--headless"],
2423
},
2524
},
2625
};

tests/acceptance/statistics-test.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
click,
3-
fillIn,
4-
currentURL,
5-
visit,
6-
find,
7-
settled,
8-
} from "@ember/test-helpers";
1+
import { click, fillIn, currentURL, visit, find } from "@ember/test-helpers";
92
import { setupMirage } from "ember-cli-mirage/test-support";
103
import { setupApplicationTest } from "ember-qunit";
114
import { authenticateSession } from "ember-simple-auth/test-support";

tests/integration/components/statistic-list/component-test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { A } from "@ember/array";
22
import ArrayProxy from "@ember/array/proxy";
3-
import { render } from "@ember/test-helpers";
3+
import { render, waitFor } from "@ember/test-helpers";
44
import { hbs } from "ember-cli-htmlbars";
55
import { setupRenderingTest } from "ember-qunit";
66
import moment from "moment";
@@ -99,6 +99,8 @@ module("Integration | Component | statistic list", function (hooks) {
9999
</div>
100100
`);
101101

102+
await waitFor("table tbody tr");
103+
102104
assert.dom("[data-test-statistic-list-column]").exists({ count: 4 });
103105
assert.dom("[data-test-statistic-list-row]").exists({ count: 2 });
104106
assert.dom(".total").hasText("34h 30m");

tests/integration/components/user-selection/component-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { find, render } from "@ember/test-helpers";
22
import { hbs } from "ember-cli-htmlbars";
3+
import { setupMirage } from "ember-cli-mirage/test-support";
34
import { setupRenderingTest } from "ember-qunit";
45
import { module, test } from "qunit";
5-
import { setupMirage } from "ember-cli-mirage/test-support";
66

77
module("Integration | Component | user selection", function (hooks) {
88
setupRenderingTest(hooks);

0 commit comments

Comments
 (0)