Skip to content

Commit fa3e159

Browse files
authored
DEV: Update linting (#275)
1 parent b868479 commit fa3e159

18 files changed

+1221
-680
lines changed

.eslintrc

-3
This file was deleted.

.eslintrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("@discourse/lint-configs/eslint");

.prettierrc

-1
This file was deleted.

.prettierrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("@discourse/lint-configs/prettier");

.template-lintrc.cjs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require("@discourse/lint-configs/template-lint");

.template-lintrc.js

-4
This file was deleted.

Gemfile.lock

+31-21
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,45 @@ GEM
22
remote: https://rubygems.org/
33
specs:
44
ast (2.4.2)
5-
json (2.6.2)
6-
parallel (1.22.1)
7-
parser (3.1.2.1)
5+
json (2.7.1)
6+
language_server-protocol (3.17.0.3)
7+
parallel (1.24.0)
8+
parser (3.3.0.4)
89
ast (~> 2.4.1)
9-
prettier_print (1.2.0)
10+
racc
11+
prettier_print (1.2.1)
12+
racc (1.7.3)
1013
rainbow (3.1.1)
11-
regexp_parser (2.6.0)
12-
rexml (3.2.5)
13-
rubocop (1.36.0)
14+
regexp_parser (2.9.0)
15+
rexml (3.2.6)
16+
rubocop (1.60.0)
1417
json (~> 2.3)
18+
language_server-protocol (>= 3.17.0)
1519
parallel (~> 1.10)
16-
parser (>= 3.1.2.1)
20+
parser (>= 3.3.0.2)
1721
rainbow (>= 2.2.2, < 4.0)
1822
regexp_parser (>= 1.8, < 3.0)
1923
rexml (>= 3.2.5, < 4.0)
20-
rubocop-ast (>= 1.20.1, < 2.0)
24+
rubocop-ast (>= 1.30.0, < 2.0)
2125
ruby-progressbar (~> 1.7)
22-
unicode-display_width (>= 1.4.0, < 3.0)
23-
rubocop-ast (1.21.0)
24-
parser (>= 3.1.1.0)
25-
rubocop-discourse (3.0)
26-
rubocop (>= 1.1.0)
27-
rubocop-rspec (>= 2.0.0)
28-
rubocop-rspec (2.13.2)
29-
rubocop (~> 1.33)
30-
ruby-progressbar (1.11.0)
31-
syntax_tree (5.1.0)
26+
unicode-display_width (>= 2.4.0, < 3.0)
27+
rubocop-ast (1.30.0)
28+
parser (>= 3.2.1.0)
29+
rubocop-capybara (2.20.0)
30+
rubocop (~> 1.41)
31+
rubocop-discourse (3.6.0)
32+
rubocop (>= 1.59.0)
33+
rubocop-rspec (>= 2.25.0)
34+
rubocop-factory_bot (2.25.1)
35+
rubocop (~> 1.41)
36+
rubocop-rspec (2.26.1)
37+
rubocop (~> 1.40)
38+
rubocop-capybara (~> 2.17)
39+
rubocop-factory_bot (~> 2.22)
40+
ruby-progressbar (1.13.0)
41+
syntax_tree (6.2.0)
3242
prettier_print (>= 1.2.0)
33-
unicode-display_width (2.3.0)
43+
unicode-display_width (2.5.0)
3444

3545
PLATFORMS
3646
ruby
@@ -40,4 +50,4 @@ DEPENDENCIES
4050
syntax_tree
4151

4252
BUNDLED WITH
43-
2.1.4
53+
2.5.4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{{#if this.siteSettings.solved_enabled}}
22
<ComboBox
3-
@class="solved-status-filter"
43
@content={{this.statuses}}
54
@value={{this.status}}
65
@valueProperty="value"
76
@options={{hash caretDownIcon="caret-right" caretUpIcon="caret-down"}}
87
@onChange={{this.changeStatus}}
8+
class="solved-status-filter"
99
/>
1010
{{/if}}

assets/javascripts/discourse/connectors/bread-crumbs-right/solved-status-filter.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import I18n from "I18n";
2-
import { getOwnerWithFallback } from "discourse-common/lib/get-owner";
31
import Component from "@glimmer/component";
42
import { action } from "@ember/object";
53
import { inject as service } from "@ember/service";
4+
import { getOwnerWithFallback } from "discourse-common/lib/get-owner";
5+
import I18n from "I18n";
66

77
const QUERY_PARAM_VALUES = {
88
solved: "yes",

assets/javascripts/discourse/initializers/add-topic-list-class.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import discourseComputed from "discourse-common/utils/decorators";
21
import TopicListItem from "discourse/components/topic-list-item";
2+
import discourseComputed from "discourse-common/utils/decorators";
33

44
export default {
55
name: "add-topic-list-class",

assets/javascripts/discourse/initializers/extend-for-solved-button.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import I18n from "I18n";
2-
import Topic from "discourse/models/topic";
3-
import User from "discourse/models/user";
4-
import TopicStatus from "discourse/raw-views/topic-status";
1+
import { computed } from "@ember/object";
52
import TopicStatusIcons from "discourse/helpers/topic-status-icons";
3+
import { ajax } from "discourse/lib/ajax";
64
import { popupAjaxError } from "discourse/lib/ajax-error";
75
import { withPluginApi } from "discourse/lib/plugin-api";
8-
import { ajax } from "discourse/lib/ajax";
9-
import PostCooked from "discourse/widgets/post-cooked";
106
import { formatUsername } from "discourse/lib/utilities";
7+
import Topic from "discourse/models/topic";
8+
import User from "discourse/models/user";
9+
import TopicStatus from "discourse/raw-views/topic-status";
10+
import PostCooked from "discourse/widgets/post-cooked";
1111
import { iconHTML, iconNode } from "discourse-common/lib/icon-library";
12-
import { computed } from "@ember/object";
12+
import I18n from "I18n";
1313

1414
function clearAccepted(topic) {
1515
const posts = topic.get("postStream.posts");

assets/javascripts/discourse/pre-initializers/extend-category-for-solved.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Category from "discourse/models/category";
21
import { computed, get } from "@ember/object";
2+
import Category from "discourse/models/category";
33

44
export default {
55
name: "extend-category-for-solved",

package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
2-
"author": "Discourse",
3-
"license": "MIT",
2+
"name": "discourse-solved",
3+
"private": true,
44
"devDependencies": {
5-
"eslint-config-discourse": "^3.4.0"
5+
"@discourse/lint-configs": "^1.3.5",
6+
"ember-template-lint": "^5.13.0",
7+
"eslint": "^8.56.0",
8+
"prettier": "^2.8.8"
69
}
710
}

plugin.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# version: 0.1
77
# authors: Sam Saffron
88
# url: https://github.com/discourse/discourse-solved
9-
# transpile_js: true
109

1110
enabled_site_setting :solved_enabled
1211

@@ -569,7 +568,7 @@ def accepted_answer
569568
end
570569

571570
def topic_accepted_answer
572-
topic&.custom_fields[::DiscourseSolved::ACCEPTED_ANSWER_POST_ID_CUSTOM_FIELD].present?
571+
topic&.custom_fields&.[](::DiscourseSolved::ACCEPTED_ANSWER_POST_ID_CUSTOM_FIELD).present?
573572
end
574573

575574
def topic

spec/requests/topics_controller_spec.rb

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ def schema_json(answerCount)
2323
answer_json = ""
2424
end
2525

26-
# rubocop:todo Layout/LineLength
2726
'<script type="application/ld+json">{"@context":"http://schema.org","@type":"QAPage","name":"%{title}","mainEntity":{"@type":"Question","name":"%{title}","text":"%{question_text}","upvoteCount":%{question_likes},"answerCount":%{answerCount},"datePublished":"%{created_at}","author":{"@type":"Person","name":"%{username1}","url":"%{user1_url}"}%{answer_json}}}</script>' %
2827
# rubocop:enable Layout/LineLength
2928
{

test/javascripts/acceptance/discourse-solved-test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
2-
import { fixturesByUrl } from "discourse/tests/helpers/create-pretender";
3-
import { test } from "qunit";
41
import { click, fillIn, visit } from "@ember/test-helpers";
2+
import { test } from "qunit";
3+
import { fixturesByUrl } from "discourse/tests/helpers/create-pretender";
4+
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
55
import { cloneJSON } from "discourse-common/lib/object";
66

77
acceptance("Discourse Solved Plugin", function (needs) {

test/javascripts/acceptance/user-activity-solved-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
2-
import { test } from "qunit";
31
import { visit } from "@ember/test-helpers";
2+
import { test } from "qunit";
3+
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
44
import I18n from "I18n";
55

66
acceptance(

0 commit comments

Comments
 (0)