Skip to content

Commit

Permalink
DEV: Update linting (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX authored Nov 29, 2023
1 parent c362cc4 commit 34a76e8
Show file tree
Hide file tree
Showing 29 changed files with 884 additions and 722 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.

45 changes: 28 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,50 @@ 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.6.3)
language_server-protocol (3.17.0.3)
parallel (1.23.0)
parser (3.2.2.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.8.2)
rexml (3.2.6)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.1.2.1)
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.20.1, < 2.0)
rubocop-ast (>= 1.28.1, < 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)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-discourse (3.4.1)
rubocop (>= 1.1.0)
rubocop-rspec (>= 2.0.0)
rubocop-rspec (2.13.2)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
ruby-progressbar (1.11.0)
syntax_tree (5.1.0)
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.2.0)
prettier_print (>= 1.2.0)
unicode-display_width (2.3.0)
unicode-display_width (2.5.0)

PLATFORMS
arm64-darwin-20
arm64-darwin-21
arm64-darwin-22
x86_64-linux

DEPENDENCIES
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { action } from "@ember/object";
import Component from "@glimmer/component";
import { action } from "@ember/object";

export default class PostVotingButton extends Component {
get buttonClasses() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { action } from "@ember/object";
import Component from "@glimmer/component";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import I18n from "I18n";

export default class PostVotingCommentActions extends Component {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { action } from "@ember/object";
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import I18n from "I18n";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { action } from "@ember/object";
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";

export default class PostVotingCommentEditor extends Component {
@service siteSettings;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { action } from "@ember/object";
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { action } from "@ember/object";
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { ajax } from "discourse/lib/ajax";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";

export default class PostVotingCommentsMenuComposer extends Component {
@service siteSettings;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Promise } from "rsvp";
import { action } from "@ember/object";
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { ajax } from "discourse/lib/ajax";
import { action } from "@ember/object";
import { schedule } from "@ember/runloop";
import { inject as service } from "@ember/service";
import { Promise } from "rsvp";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";

export default class PostVotingCommentsMenu extends Component {
@service currentUser;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { action } from "@ember/object";
import Component from "@glimmer/component";
import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object";

export default class PostVotingComments extends Component {
@tracked comments = this.args.post.comments;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Component from "@ember/component";
import { ORDER_BY_ACTIVITY_FILTER } from "../initializers/post-voting-edits";
import { scheduleOnce } from "@ember/runloop";
import { ORDER_BY_ACTIVITY_FILTER } from "../initializers/post-voting-edits";

export default Component.extend({
tagName: "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import I18n from "I18n";
import { withPluginApi } from "discourse/lib/plugin-api";
import { CREATE_TOPIC } from "discourse/models/composer";
import { observes } from "discourse-common/utils/decorators";
import I18n from "I18n";

export default {
name: "extend-composer-actions",
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 const ORDER_BY_ACTIVITY_FILTER = "activity";
const pluginId = "discourse-post-voting";
Expand Down
2 changes: 1 addition & 1 deletion assets/javascripts/discourse/lib/post-voting-utilities.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { popupAjaxError } from "discourse/lib/ajax-error";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";

const vote = function (type, data) {
return ajax("/post_voting/vote", {
Expand Down
6 changes: 3 additions & 3 deletions assets/javascripts/discourse/widgets/post-voting-post.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createWidget } from "discourse/widgets/widget";
import { castVote, removeVote, whoVoted } from "../lib/post-voting-utilities";
import { h } from "virtual-dom";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { smallUserAtts } from "discourse/widgets/actions-summary";
import { createWidget } from "discourse/widgets/widget";
import { iconNode } from "discourse-common/lib/icon-library";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { castVote, removeVote, whoVoted } from "../lib/post-voting-utilities";

export default createWidget("post-voting-post", {
tagName: "div.post-voting-post",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { 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 { postUrl } from "discourse/lib/utilities";
import { buildAnchorId } from "../components/post-voting-comment";

createWidgetFrom(
Expand Down
4 changes: 2 additions & 2 deletions extensions/topic_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ def last_commented_on
end

def last_answer_post_number
return unless answers.any?
return if answers.none?

answers.last.post_number
end

def last_answerer
return unless answers.any?
return if answers.none?

@last_answerer ||= User.find(answers.last[:user_id])
end
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": "Alan Tan",
"license": "MIT",
"devDependencies": {
"eslint-config-discourse": "^3.5.0"
"@discourse/lint-configs": "^1.2.0",
"ember-template-lint": "^5.13.0",
"eslint": "^8.54.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: 0.0.1
# authors: Alan Tan
# url: https://github.com/discourse/discourse-post-voting
# transpile_js: true

%i[common mobile desktop].each do |type|
register_asset "stylesheets/#{type}/post-voting.scss", type
Expand Down
2 changes: 1 addition & 1 deletion test/javascripts/acceptance/category-edit-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import pretender from "discourse/tests/helpers/create-pretender";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";

acceptance("Category Edit", function (needs) {
needs.user();
Expand Down
6 changes: 3 additions & 3 deletions test/javascripts/acceptance/composer-test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import Category from "discourse/models/category";
import { parsePostData } 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 { test } from "qunit";
import I18n from "I18n";
import { parsePostData } from "discourse/tests/helpers/create-pretender";
import Category from "discourse/models/category";

let createAsPostVotingSetInRequest = false;

Expand Down
4 changes: 2 additions & 2 deletions test/javascripts/acceptance/notifications-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import I18n from "I18n";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import I18n from "I18n";

acceptance("Discourse Post Voting - notifications", function (needs) {
needs.user();
Expand Down
6 changes: 3 additions & 3 deletions test/javascripts/acceptance/post-voting-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import {
triggerEvent,
visit,
} from "@ember/test-helpers";
import { test } from "qunit";
import discoveryFixtures from "discourse/tests/fixtures/discovery-fixtures";
import topicFixtures from "discourse/tests/fixtures/topic";
import {
acceptance,
exists,
Expand All @@ -13,9 +16,6 @@ import {
queryAll,
updateCurrentUser,
} from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import topicFixtures from "discourse/tests/fixtures/topic";
import discoveryFixtures from "discourse/tests/fixtures/discovery-fixtures";
import { cloneJSON } from "discourse-common/lib/object";
import I18n from "I18n";

Expand Down
Loading

0 comments on commit 34a76e8

Please sign in to comment.