Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEV: Use @discourse/lint-configs #517

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .eslintrc

This file was deleted.

1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/eslint");
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.bundle/
auto_generated
.DS_Store
node_modules/
node_modules
/gems
/auto_generated
17 changes: 0 additions & 17 deletions .prettierrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/prettier");
5 changes: 1 addition & 4 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
module.exports = {
plugins: ["ember-template-lint-plugin-discourse"],
extends: "discourse:recommended",
};
module.exports = require("@discourse/lint-configs/template-lint");
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { action } from "@ember/object";
import I18n from "I18n";
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
import { action } from "@ember/object";

export default DropdownSelectBoxComponent.extend({
classNames: ["assign-actions-dropdown"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
import Component from "@glimmer/component";
import AssignActionsDropdown from "./assign-actions-dropdown";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import AssignActionsDropdown from "./assign-actions-dropdown";

export default class AssignedTopicListColumn extends Component {
<template>
{{#if @topic.assigned_to_user}}
<AssignActionsDropdown
@topic={{@topic}}
@assignee={{@topic.assigned_to_user.username}}
@unassign={{this.unassign}}
@reassign={{this.reassign}}
/>
{{else if @topic.assigned_to_group}}
<AssignActionsDropdown
@topic={{@topic}}
@assignee={{@topic.assigned_to_group.name}}
@group={{true}}
@unassign={{this.unassign}}
@reassign={{this.reassign}}
/>
{{else}}
<AssignActionsDropdown @topic={{@topic}} @unassign={{this.unassign}} />
{{/if}}
</template>

@service taskActions;
@service router;

Expand All @@ -40,4 +19,25 @@ export default class AssignedTopicListColumn extends Component {
onSuccess: () => this.router.refresh(),
});
}

<template>
{{#if @topic.assigned_to_user}}
<AssignActionsDropdown
@topic={{@topic}}
@assignee={{@topic.assigned_to_user.username}}
@unassign={{this.unassign}}
@reassign={{this.reassign}}
/>
{{else if @topic.assigned_to_group}}
<AssignActionsDropdown
@topic={{@topic}}
@assignee={{@topic.assigned_to_group.name}}
@group={{true}}
@unassign={{this.unassign}}
@reassign={{this.reassign}}
/>
{{else}}
<AssignActionsDropdown @topic={{@topic}} @unassign={{this.unassign}} />
{{/if}}
</template>
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from "@ember/component";
import I18n from "I18n";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "I18n";

export default class RemindAssignsFrequency extends Component {
@discourseComputed(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import UserMenuNotificationsList from "discourse/components/user-menu/notifications-list";
import { ajax } from "discourse/lib/ajax";
import UserMenuNotificationItem from "discourse/lib/user-menu/notification-item";
import UserMenuAssignItem from "../../lib/user-menu/assign-item";
import Notification from "discourse/models/notification";
import I18n from "I18n";
import Topic from "discourse/models/topic";
import I18n from "I18n";
import UserMenuAssignItem from "../../lib/user-menu/assign-item";
import UserMenuAssignsListEmptyState from "./assigns-list-empty-state";

export default class UserMenuAssignNotificationsList extends UserMenuNotificationsList {
Expand Down
10 changes: 5 additions & 5 deletions assets/javascripts/discourse/controllers/group-assigned-show.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import UserTopicsList from "discourse/controllers/user-topics-list";
import { alias } from "@ember/object/computed";
import discourseDebounce from "discourse-common/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { inject as controller } from "@ember/controller";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
import { alias } from "@ember/object/computed";
import { inject as service } from "@ember/service";
import UserTopicsList from "discourse/controllers/user-topics-list";
import { INPUT_DELAY } from "discourse-common/config/environment";
import discourseDebounce from "discourse-common/lib/debounce";

export default class GroupAssignedShow extends UserTopicsList {
@service taskActions;
Expand Down
6 changes: 3 additions & 3 deletions assets/javascripts/discourse/controllers/group-assigned.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { inject as service } from "@ember/service";
import Controller, { inject as controller } from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import discourseComputed from "discourse-common/utils/decorators";
import discourseDebounce from "discourse-common/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import discourseDebounce from "discourse-common/lib/debounce";
import discourseComputed from "discourse-common/utils/decorators";

export default class GroupAssigned extends Controller {
@service router;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import UserTopicsList from "discourse/controllers/user-topics-list";
import discourseComputed from "discourse-common/utils/decorators";
import discourseDebounce from "discourse-common/lib/debounce";
import { INPUT_DELAY } from "discourse-common/config/environment";
import { inject as controller } from "@ember/controller";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { htmlSafe } from "@ember/template";
import UserTopicsList from "discourse/controllers/user-topics-list";
import { INPUT_DELAY } from "discourse-common/config/environment";
import discourseDebounce from "discourse-common/lib/debounce";
import getURL from "discourse-common/lib/get-url";
import { iconHTML } from "discourse-common/lib/icon-library";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "I18n";
import { htmlSafe } from "@ember/template";

export default class UserActivityAssigned extends UserTopicsList {
@service taskActions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import I18n from "I18n";
import { withPluginApi } from "discourse/lib/plugin-api";
import I18n from "I18n";

export default {
name: "assign-extend-user-messages",
Expand Down
16 changes: 8 additions & 8 deletions assets/javascripts/discourse/initializers/extend-for-assigns.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { htmlSafe } from "@ember/template";
import { isEmpty } from "@ember/utils";
import { h } from "virtual-dom";
import SearchAdvancedOptions from "discourse/components/search-advanced-options";
import { renderAvatar } from "discourse/helpers/user-avatar";
import { withPluginApi } from "discourse/lib/plugin-api";
import discourseComputed from "discourse-common/utils/decorators";
import { iconHTML, iconNode } from "discourse-common/lib/icon-library";
import { registerTopicFooterDropdown } from "discourse/lib/register-topic-footer-dropdown";
import { escapeExpression } from "discourse/lib/utilities";
import { h } from "virtual-dom";
import RawHtml from "discourse/widgets/raw-html";
import { getOwner } from "discourse-common/lib/get-owner";
import { htmlSafe } from "@ember/template";
import getURL from "discourse-common/lib/get-url";
import SearchAdvancedOptions from "discourse/components/search-advanced-options";
import { iconHTML, iconNode } from "discourse-common/lib/icon-library";
import discourseComputed from "discourse-common/utils/decorators";
import I18n from "I18n";
import { isEmpty } from "@ember/utils";
import { registerTopicFooterDropdown } from "discourse/lib/register-topic-footer-dropdown";
import RawHtml from "discourse/widgets/raw-html";
import BulkAssign from "../components/bulk-actions/assign-user";

const PLUGIN_ID = "discourse-assign";
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/lib/user-menu/assign-item.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import UserMenuBaseItem from "discourse/lib/user-menu/base-item";
import { postUrl } from "discourse/lib/utilities";
import { htmlSafe } from "@ember/template";
import { emojiUnescape } from "discourse/lib/text";
import UserMenuBaseItem from "discourse/lib/user-menu/base-item";
import { postUrl } from "discourse/lib/utilities";
import I18n from "I18n";

const ICON = "user-plus";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Category from "discourse/models/category";
import { computed } from "@ember/object";
import Category from "discourse/models/category";

export default {
name: "extend-category-for-assign",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import EmberObject from "@ember/object";
import { inject as service } from "@ember/service";
import rawRenderGlimmer from "discourse/lib/raw-render-glimmer";
import AssignedTopicListColumn from "../components/assigned-topic-list-column";
import { inject as service } from "@ember/service";

const ASSIGN_LIST_ROUTES = ["userActivity.assigned", "group.assigned.show"];

Expand Down
2 changes: 1 addition & 1 deletion assets/javascripts/discourse/routes/group-assigned-show.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DiscourseRoute from "discourse/routes/discourse";
import { findOrResetCachedTopicList } from "discourse/lib/cached-topic-list";
import DiscourseRoute from "discourse/routes/discourse";

export default class GroupAssignedShow extends DiscourseRoute {
model(params) {
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/routes/group-assigned.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DiscourseRoute from "discourse/routes/discourse";
import { ajax } from "discourse/lib/ajax";
import { inject as service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import DiscourseRoute from "discourse/routes/discourse";

export default class GroupAssigned extends DiscourseRoute {
@service router;
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/routes/user-activity-assigned.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import I18n from "I18n";
import UserTopicListRoute from "discourse/routes/user-topic-list";
import cookie from "discourse/lib/cookie";
import UserTopicListRoute from "discourse/routes/user-topic-list";
import I18n from "I18n";

export default class UserActivityAssigned extends UserTopicListRoute {
templateName = "user-activity-assigned";
Expand Down
6 changes: 3 additions & 3 deletions assets/javascripts/discourse/services/task-actions.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Service, { inject as service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import AssignUser from "../components/modal/assign-user";
import { tracked } from "@glimmer/tracking";
import Service, { inject as service } from "@ember/service";
import { isEmpty } from "@ember/utils";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import AssignUser from "../components/modal/assign-user";

export default class TaskActions extends Service {
@service modal;
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"author": "Discourse",
"license": "MIT",
"devDependencies": {
"eslint-config-discourse": "^4.0.0",
"prettier-plugin-ember-template-tag": "^0.3.2"
"@discourse/lint-configs": "^1.0.0",
"ember-template-lint": "^5.11.2",
"eslint": "^8.51.0",
"prettier": "^2.8.8"
}
}
4 changes: 2 additions & 2 deletions test/javascripts/acceptance/assign-disabled-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";

acceptance("Discourse Assign | Assign disabled mobile", function (needs) {
needs.user({ can_assign: true });
Expand Down
14 changes: 7 additions & 7 deletions test/javascripts/acceptance/assign-enabled-test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { cloneJSON } from "discourse-common/lib/object";
import userFixtures from "discourse/tests/fixtures/user-fixtures";
import {
acceptance,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import userFixtures from "discourse/tests/fixtures/user-fixtures";
import pretender, {
parsePostData,
response,
} from "discourse/tests/helpers/create-pretender";
import {
acceptance,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { cloneJSON } from "discourse-common/lib/object";

acceptance("Discourse Assign | Assign mobile", function (needs) {
needs.user();
Expand Down
6 changes: 3 additions & 3 deletions test/javascripts/acceptance/assigned-topic-test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import topicFixtures from "discourse/tests/fixtures/topic";
import {
acceptance,
query,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { cloneJSON } from "discourse-common/lib/object";
import I18n from "I18n";
import topicFixtures from "discourse/tests/fixtures/topic";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import NotificationFixture from "../fixtures/notifications-fixtures";

function assignCurrentUserToTopic(needs) {
Expand Down
6 changes: 3 additions & 3 deletions test/javascripts/acceptance/assigns-tab-user-menu-test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { click, currentURL, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { withPluginApi } from "discourse/lib/plugin-api";
import {
acceptance,
query,
queryAll,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import { click, currentURL, visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";
import { withPluginApi } from "discourse/lib/plugin-api";

const USER_MENU_ASSIGN_RESPONSE = {
notifications: [
Expand Down
6 changes: 3 additions & 3 deletions test/javascripts/acceptance/bulk-actions-test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import { click, fillIn, visit } from "@ember/test-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { test } from "qunit";
import pretender, {
parsePostData,
response,
} from "discourse/tests/helpers/create-pretender";
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import I18n from "I18n";

acceptance("Discourse Assign | Bulk actions", function (needs) {
Expand Down
4 changes: 2 additions & 2 deletions test/javascripts/acceptance/category-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";
import DiscoveryFixtures from "discourse/tests/fixtures/discovery-fixtures";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import I18n from "I18n";

function stubCategory(needs, customFields) {
needs.site({
Expand Down
4 changes: 2 additions & 2 deletions test/javascripts/acceptance/group-assignments-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import AssignedTopics from "../fixtures/assigned-group-assignments-fixtures";
import GroupMembers from "../fixtures/group-members-fixtures";
import { test } from "qunit";

acceptance("Discourse Assign | GroupAssignments", function (needs) {
needs.user();
Expand Down
Loading