DEV: Update linting (#275)

This commit is contained in:
Jarek Radosz 2024-01-16 17:50:43 +01:00 committed by GitHub
parent b8684799cb
commit fa3e1598aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 1214 additions and 673 deletions

View File

@ -1,3 +0,0 @@
{
"extends": "eslint-config-discourse"
}

1
.eslintrc.cjs Normal file
View File

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

View File

@ -1 +0,0 @@
{}

1
.prettierrc.cjs Normal file
View File

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

1
.template-lintrc.cjs Normal file
View File

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

View File

@ -1,4 +0,0 @@
module.exports = {
plugins: ["ember-template-lint-plugin-discourse"],
extends: "discourse:recommended",
};

View File

@ -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
@ -40,4 +50,4 @@ DEPENDENCIES
syntax_tree
BUNDLED WITH
2.1.4
2.5.4

View File

@ -1,10 +1,10 @@
{{#if this.siteSettings.solved_enabled}}
<ComboBox
@class="solved-status-filter"
@content={{this.statuses}}
@value={{this.status}}
@valueProperty="value"
@options={{hash caretDownIcon="caret-right" caretUpIcon="caret-down"}}
@onChange={{this.changeStatus}}
class="solved-status-filter"
/>
{{/if}}

View File

@ -1,8 +1,8 @@
import I18n from "I18n";
import { getOwnerWithFallback } from "discourse-common/lib/get-owner";
import Component from "@glimmer/component";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { getOwnerWithFallback } from "discourse-common/lib/get-owner";
import I18n from "I18n";
const QUERY_PARAM_VALUES = {
solved: "yes",

View File

@ -1,5 +1,5 @@
import discourseComputed from "discourse-common/utils/decorators";
import TopicListItem from "discourse/components/topic-list-item";
import discourseComputed from "discourse-common/utils/decorators";
export default {
name: "add-topic-list-class",

View File

@ -1,15 +1,15 @@
import I18n from "I18n";
import { computed } from "@ember/object";
import TopicStatusIcons from "discourse/helpers/topic-status-icons";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { withPluginApi } from "discourse/lib/plugin-api";
import { formatUsername } from "discourse/lib/utilities";
import Topic from "discourse/models/topic";
import User from "discourse/models/user";
import TopicStatus from "discourse/raw-views/topic-status";
import TopicStatusIcons from "discourse/helpers/topic-status-icons";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { withPluginApi } from "discourse/lib/plugin-api";
import { ajax } from "discourse/lib/ajax";
import PostCooked from "discourse/widgets/post-cooked";
import { formatUsername } from "discourse/lib/utilities";
import { iconHTML, iconNode } from "discourse-common/lib/icon-library";
import { computed } from "@ember/object";
import I18n from "I18n";
function clearAccepted(topic) {
const posts = topic.get("postStream.posts");

View File

@ -1,5 +1,5 @@
import Category from "discourse/models/category";
import { computed, get } from "@ember/object";
import Category from "discourse/models/category";
export default {
name: "extend-category-for-solved",

View File

@ -1,7 +1,10 @@
{
"author": "Discourse",
"license": "MIT",
"name": "discourse-solved",
"private": true,
"devDependencies": {
"eslint-config-discourse": "^3.4.0"
"@discourse/lint-configs": "^1.3.5",
"ember-template-lint": "^5.13.0",
"eslint": "^8.56.0",
"prettier": "^2.8.8"
}
}

View File

@ -6,7 +6,6 @@
# version: 0.1
# authors: Sam Saffron
# url: https://github.com/discourse/discourse-solved
# transpile_js: true
enabled_site_setting :solved_enabled
@ -569,7 +568,7 @@ SQL
end
def topic_accepted_answer
topic&.custom_fields[::DiscourseSolved::ACCEPTED_ANSWER_POST_ID_CUSTOM_FIELD].present?
topic&.custom_fields&.[](::DiscourseSolved::ACCEPTED_ANSWER_POST_ID_CUSTOM_FIELD).present?
end
def topic

View File

@ -23,7 +23,6 @@ RSpec.describe TopicsController do
answer_json = ""
end
# rubocop:todo Layout/LineLength
'<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>' %
# rubocop:enable Layout/LineLength
{

View File

@ -1,7 +1,7 @@
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import { fixturesByUrl } from "discourse/tests/helpers/create-pretender";
import { test } from "qunit";
import { click, fillIn, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { fixturesByUrl } from "discourse/tests/helpers/create-pretender";
import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import { cloneJSON } from "discourse-common/lib/object";
acceptance("Discourse Solved Plugin", function (needs) {

View File

@ -1,6 +1,6 @@
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
import I18n from "I18n";
acceptance(

1777
yarn.lock

File diff suppressed because it is too large Load Diff