Skip to content

Commit

Permalink
DEV: Update linting (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX authored Jan 16, 2024
1 parent 0d323c3 commit 2ceaa16
Show file tree
Hide file tree
Showing 14 changed files with 1,217 additions and 665 deletions.
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");
1 change: 0 additions & 1 deletion .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");
1 change: 1 addition & 0 deletions .template-lintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/template-lint");
4 changes: 0 additions & 4 deletions .template-lintrc.js

This file was deleted.

52 changes: 31 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,45 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
json (2.6.2)
parallel (1.22.1)
parser (3.1.2.1)
json (2.7.1)
language_server-protocol (3.17.0.3)
parallel (1.24.0)
parser (3.3.0.4)
ast (~> 2.4.1)
prettier_print (1.2.0)
racc
prettier_print (1.2.1)
racc (1.7.3)
rainbow (3.1.1)
regexp_parser (2.6.0)
rexml (3.2.5)
rubocop (1.36.0)
regexp_parser (2.9.0)
rexml (3.2.6)
rubocop (1.60.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.2.1)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.20.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.21.0)
parser (>= 3.1.1.0)
rubocop-discourse (3.0)
rubocop (>= 1.1.0)
rubocop-rspec (>= 2.0.0)
rubocop-rspec (2.13.2)
rubocop (~> 1.33)
ruby-progressbar (1.11.0)
syntax_tree (5.1.0)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-discourse (3.6.0)
rubocop (>= 1.59.0)
rubocop-rspec (>= 2.25.0)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-rspec (2.26.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
unicode-display_width (2.3.0)
unicode-display_width (2.5.0)

PLATFORMS
ruby
Expand All @@ -40,4 +50,4 @@ DEPENDENCIES
syntax_tree

BUNDLED WITH
2.1.4
2.5.4
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import discourseComputed, { observes } from "discourse-common/utils/decorators";
import { inject as service } from "@ember/service";
import { apiInitializer } from "discourse/lib/api";
import discourseComputed, { observes } from "discourse-common/utils/decorators";

const PLUGIN_ID = "whos-online";

export default apiInitializer("0.8", (api) => {
const siteSettings = api.container.lookup("site-settings:main");
const siteSettings = api.container.lookup("service:site-settings");

const indicatorType = siteSettings.whos_online_avatar_indicator;
if (indicatorType === "none") {
Expand All @@ -26,6 +26,7 @@ export default apiInitializer("0.8", (api) => {

api.modifyClass("component:user-card-contents", {
pluginId: PLUGIN_ID,

whosOnline: service(),
classNameBindings: ["isOnline:user-online"],

Expand All @@ -37,6 +38,7 @@ export default apiInitializer("0.8", (api) => {

api.modifyClass("route:user", {
pluginId: PLUGIN_ID,

whosOnline: service(),

async afterModel(model) {
Expand Down Expand Up @@ -69,8 +71,10 @@ export default apiInitializer("0.8", (api) => {
if (siteSettings.whos_online_avatar_indicator_topic_lists) {
api.modifyClass("component:topic-list-item", {
pluginId: PLUGIN_ID,

whosOnline: service(),
classNameBindings: ["isOnline:last-poster-online"],

@discourseComputed(
"topic.lastPoster.id",
"topic.lastPosterUser.id",
Expand All @@ -83,8 +87,10 @@ export default apiInitializer("0.8", (api) => {

api.modifyClass("component:latest-topic-list-item", {
pluginId: PLUGIN_ID,

whosOnline: service(),
classNameBindings: ["isOnline:last-poster-online"],

@discourseComputed(
"topic.lastPoster.id",
"topic.lastPosterUser.id",
Expand All @@ -98,6 +104,7 @@ export default apiInitializer("0.8", (api) => {

api.modifyClass("component:scrolling-post-stream", {
pluginId: PLUGIN_ID,

didInsertElement() {
this._super();
this.appEvents.on("whosonline:changed", this, this._whosOnlineCallback);
Expand Down
2 changes: 1 addition & 1 deletion assets/javascripts/discourse/components/whos-online.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Component from "@ember/component";
import { inject as service } from "@ember/service";
import { computed } from "@ember/object";
import { readOnly } from "@ember/object/computed";
import { inject as service } from "@ember/service";

export default class WhosOnline extends Component {
@service whosOnline;
Expand Down
4 changes: 2 additions & 2 deletions assets/javascripts/discourse/services/whos-online.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Service, { inject as service } from "@ember/service";
import Site from "discourse/models/site";
import { computed } from "@ember/object";
import { readOnly } from "@ember/object/computed";
import Service, { inject as service } from "@ember/service";
import Site from "discourse/models/site";

export default class WhosOnlineService extends Service {
@service presence;
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "discourse-whos-online",
"version": "1.0.0",
"repository": "[email protected]:discourse/discourse-whos-online.git",
"author": "David Taylor",
"license": "MIT",
"private": true,
"devDependencies": {
"eslint-config-discourse": "^2.0.0"
"@discourse/lint-configs": "^1.3.5",
"ember-template-lint": "^5.13.0",
"eslint": "^8.56.0",
"prettier": "^2.8.8"
}
}
1 change: 0 additions & 1 deletion plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# version: 2.0
# authors: David Taylor
# url: https://github.com/discourse/discourse-whos-online
# transpile_js: true

enabled_site_setting :whos_online_enabled

Expand Down
6 changes: 3 additions & 3 deletions test/javascripts/acceptance/whos-online-test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { joinChannel } from "discourse/tests/helpers/presence-pretender";
import {
acceptance,
count,
exists,
} from "discourse/tests/helpers/qunit-helpers";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { joinChannel } from "discourse/tests/helpers/presence-pretender";

acceptance("Discourse Whos Online", function (needs) {
needs.user();
Expand Down
Loading

0 comments on commit 2ceaa16

Please sign in to comment.