Skip to content

Commit

Permalink
DEV: Update linting (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX authored Nov 29, 2023
1 parent 6558779 commit f549148
Show file tree
Hide file tree
Showing 29 changed files with 652 additions and 506 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");
2 changes: 1 addition & 1 deletion .streerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
--print-width=100
--plugins=plugin/trailing_comma,disable_ternary
--plugins=plugin/trailing_comma,plugin/disable_auto_ternary
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.

1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ source "https://rubygems.org"
group :development do
gem "rubocop-discourse"
gem "syntax_tree"
gem "syntax_tree-disable_ternary"
end
31 changes: 14 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,53 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
base64 (0.1.1)
json (2.6.3)
language_server-protocol (3.17.0.3)
parallel (1.23.0)
parser (3.2.2.3)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
racc (1.7.1)
racc (1.7.3)
rainbow (3.1.1)
regexp_parser (2.8.1)
regexp_parser (2.8.2)
rexml (3.2.6)
rubocop (1.56.3)
base64 (~> 0.1.1)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.3)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.18.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-discourse (3.3.0)
rubocop-discourse (3.4.1)
rubocop (>= 1.1.0)
rubocop-rspec (>= 2.0.0)
rubocop-factory_bot (2.23.1)
rubocop (~> 1.33)
rubocop-rspec (2.23.0)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-rspec (2.25.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
syntax_tree (6.1.1)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
syntax_tree-disable_ternary (1.0.0)
unicode-display_width (2.4.2)
unicode-display_width (2.5.0)

PLATFORMS
ruby
x86_64-linux

DEPENDENCIES
rubocop-discourse
syntax_tree
syntax_tree-disable_ternary

BUNDLED WITH
2.3.9
4 changes: 2 additions & 2 deletions app/models/discourse_reactions/reaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class Reaction < ActiveRecord::Base
scope :positive, -> { where(reaction_value: self.positive_reactions) }
scope :negative_or_neutral, -> { where(reaction_value: self.negative_or_neutral_reactions) }
scope :by_user,
->(user) {
->(user) do
joins(:reaction_users).where(discourse_reactions_reaction_users: { user_id: user.id })
}
end

def self.valid_reactions
Set[
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Component from "@glimmer/component";
import { equal } from "@ember/object/computed";
import getURL from "discourse-common/lib/get-url";
import { emojiUrlFor } from "discourse/lib/text";
import { inject as service } from "@ember/service";
import { emojiUrlFor } from "discourse/lib/text";
import getURL from "discourse-common/lib/get-url";

export default class DiscourseReactionsReactionPost extends Component {
@service site;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { tracked } from "@glimmer/tracking";
import Controller, { inject as controller } from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import CustomReaction from "../models/discourse-reactions-custom-reaction";
import { tracked } from "@glimmer/tracking";

export default class UserActivityReactions extends Controller {
@service siteSettings;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
resource: "user.userActivity",
map() {
this.route("reactions", { path: "reactions" });
this.route("reactions");
},
};
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { resetCurrentReaction } from "discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-actions";
import { withPluginApi } from "discourse/lib/plugin-api";
import { replaceIcon } from "discourse-common/lib/icon-library";
import { emojiUrlFor } from "discourse/lib/text";
import { userPath } from "discourse/lib/url";
import { formatUsername } from "discourse/lib/utilities";
import { replaceIcon } from "discourse-common/lib/icon-library";
import I18n from "I18n";
import { resetCurrentReaction } from "discourse/plugins/discourse-reactions/discourse/widgets/discourse-reactions-actions";

const PLUGIN_ID = "discourse-reactions";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import EmberObject from "@ember/object";
import { ajax } from "discourse/lib/ajax";
import Category from "discourse/models/category";
import Post from "discourse/models/post";
import RestModel from "discourse/models/rest";
import Topic from "discourse/models/topic";
import User from "discourse/models/user";
import Post from "discourse/models/post";
import Category from "discourse/models/category";
import EmberObject from "@ember/object";

const CustomReaction = RestModel.extend({
init() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { cancel, later, run, schedule } from "@ember/runloop";
import { createPopper } from "@popperjs/core";
import { emojiUrlFor } from "discourse/lib/text";
import $ from "jquery";
import { Promise } from "rsvp";
import { cancel, later, run, schedule } from "@ember/runloop";
import { emojiUrlFor } from "discourse/lib/text";
import { createWidget } from "discourse/widgets/widget";
import CustomReaction from "../models/discourse-reactions-custom-reaction";
import { isTesting } from "discourse-common/config/environment";
import I18n from "I18n";
import CustomReaction from "../models/discourse-reactions-custom-reaction";

const VIBRATE_DURATION = 5;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { h } from "virtual-dom";
import { iconNode } from "discourse-common/lib/icon-library";
import { createWidget } from "discourse/widgets/widget";
import { iconNode } from "discourse-common/lib/icon-library";
import CustomReaction from "../models/discourse-reactions-custom-reaction";

export default createWidget("discourse-reactions-counter", {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { schedule } from "@ember/runloop";
import { createPopper } from "@popperjs/core";
import { h } from "virtual-dom";
import RawHtml from "discourse/widgets/raw-html";
import { emojiUnescape } from "discourse/lib/text";
import RawHtml from "discourse/widgets/raw-html";
import { createWidget } from "discourse/widgets/widget";
import { schedule } from "@ember/runloop";
import I18n from "I18n";

const DISPLAY_MAX_USERS = 19;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import RawHtml from "discourse/widgets/raw-html";
import { emojiUnescape } from "discourse/lib/text";
import { h } from "virtual-dom";
import { emojiUnescape } from "discourse/lib/text";
import RawHtml from "discourse/widgets/raw-html";
import { createWidget } from "discourse/widgets/widget";

export default createWidget("discourse-reactions-picker", {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { isBlank } from "@ember/utils";
import I18n from "I18n";
import { iconNode } from "discourse-common/lib/icon-library";
import { emojiUrlFor } from "discourse/lib/text";
import { h } from "virtual-dom";
import { emojiUrlFor } from "discourse/lib/text";
import { createWidget } from "discourse/widgets/widget";
import { iconNode } from "discourse-common/lib/icon-library";
import I18n from "I18n";

export default createWidget("discourse-reactions-reaction-button", {
tagName: "div.discourse-reactions-reaction-button",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createWidgetFrom } from "discourse/widgets/widget";
import { userPath } from "discourse/lib/url";
import { formatUsername, postUrl } from "discourse/lib/utilities";
import { DefaultNotificationItem } from "discourse/widgets/default-notification-item";
import { createWidgetFrom } from "discourse/widgets/widget";
import { iconNode } from "discourse-common/lib/icon-library";
import { formatUsername, postUrl } from "discourse/lib/utilities";
import { userPath } from "discourse/lib/url";
import I18n from "I18n";

createWidgetFrom(DefaultNotificationItem, "reaction-notification-item", {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import I18n from "I18n";
import RawHtml from "discourse/widgets/raw-html";
import { emojiUnescape } from "discourse/lib/text";
import { h } from "virtual-dom";
import { createWidget } from "discourse/widgets/widget";
import { emojiUnescape } from "discourse/lib/text";
import { avatarFor } from "discourse/widgets/post";
import RawHtml from "discourse/widgets/raw-html";
import { createWidget } from "discourse/widgets/widget";
import { iconNode } from "discourse-common/lib/icon-library";
import I18n from "I18n";

const MAX_USERS_COUNT = 26;
const MIN_USERS_COUNT = 8;
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"author": "Discourse",
"license": "MIT",
"devDependencies": {
"eslint-config-discourse": "^4.0.0"
"@discourse/lint-configs": "^1.2.0",
"ember-template-lint": "^5.13.0",
"eslint": "^8.54.0",
"prettier": "^2.8.8"
}
}
2 changes: 1 addition & 1 deletion test/javascripts/acceptance/deleted-post-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures";
import { visit } from "@ember/test-helpers";

acceptance("Discourse Reactions - Deleted post", function (needs) {
needs.user();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures";
import { visit } from "@ember/test-helpers";

acceptance("Discourse Reactions - Disabled", function (needs) {
needs.user();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";
import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures";
import { visit } from "@ember/test-helpers";

acceptance("Discourse Reactions - Enabled", function (needs) {
needs.user();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import I18n from "I18n";

acceptance("Discourse Reactions - Notifications", function (needs) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { visit } from "@ember/test-helpers";
import { skip, test } from "qunit";
import {
acceptance,
exists,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import { default as ReactionsTopics } from "../fixtures/reactions-topic-fixtures";
import { visit } from "@ember/test-helpers";

acceptance("Discourse Reactions - Post", function (needs) {
needs.user();
Expand Down
Loading

0 comments on commit f549148

Please sign in to comment.