DEV: Update linting (#181)

This commit is contained in:
Jarek Radosz 2023-11-29 23:01:31 +01:00 committed by GitHub
parent bd9bf836ad
commit bc81d30dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 1119 additions and 899 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

@ -1,6 +1,6 @@
GIT
remote: https://github.com/discourse/translations-manager.git
revision: d6da5ff928b9ea39a15c9b6f16b856f46bc9069b
revision: a8b225f7fabd3250ba88a4a2eff797693df51192
specs:
translations-manager (0.6)
@ -8,38 +8,49 @@ 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
ruby
x86_64-linux
DEPENDENCIES
rubocop-discourse

View File

@ -1,8 +1,8 @@
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 I18n from "I18n";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
export default class ChannelDetails extends Component {
@service dialog;

View File

@ -1,6 +1,6 @@
import Component from "@glimmer/component";
import EmberObject, { action } from "@ember/object";
import { tracked } from "@glimmer/tracking";
import EmberObject, { action } from "@ember/object";
import I18n from "I18n";
export default class ChannelParamRow extends Component {

View File

@ -1,7 +1,7 @@
import { action } from "@ember/object";
import Component from "@glimmer/component";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { popupAjaxError } from "discourse/lib/ajax-error";
export default class RuleRow extends Component {
@service siteSettings;

View File

@ -1,7 +1,7 @@
import Controller from "@ember/controller";
import showModal from "discourse/lib/show-modal";
import { tracked } from "@glimmer/tracking";
import Controller from "@ember/controller";
import { action } from "@ember/object";
import showModal from "discourse/lib/show-modal";
const MODALS = {
editChannel: "admin-plugins-chat-integration-edit-channel",

View File

@ -1,8 +1,8 @@
import Controller from "@ember/controller";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { action } from "@ember/object";
import { tracked } from "@glimmer/tracking";
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { popupAjaxError } from "discourse/lib/ajax-error";
import ModalFunctionality from "discourse/mixins/modal-functionality";
export default class AdminPluginsChatIntegrationEditChannel extends Controller.extend(
ModalFunctionality

View File

@ -1,9 +1,9 @@
import Controller from "@ember/controller";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { tracked } from "@glimmer/tracking";
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import { popupAjaxError } from "discourse/lib/ajax-error";
import ModalFunctionality from "discourse/mixins/modal-functionality";
export default class AdminPluginsChatIntegrationEditRule extends Controller.extend(
ModalFunctionality

View File

@ -1,11 +1,11 @@
import { tracked } from "@glimmer/tracking";
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { not } from "@ember/object/computed";
import I18n from "I18n";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { action } from "@ember/object";
import { tracked } from "@glimmer/tracking";
import ModalFunctionality from "discourse/mixins/modal-functionality";
import I18n from "I18n";
export default class AdminPluginsChatIntegrationTest extends Controller.extend(
ModalFunctionality

View File

@ -1,7 +1,7 @@
import I18n from "I18n";
import RestModel from "discourse/models/rest";
import Category from "discourse/models/category";
import { tracked } from "@glimmer/tracking";
import Category from "discourse/models/category";
import RestModel from "discourse/models/rest";
import I18n from "I18n";
export default class Rule extends RestModel {
@tracked type = "normal";

View File

@ -1,5 +1,5 @@
import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service";
import DiscourseRoute from "discourse/routes/discourse";
export default class AdminPluginsChatIntegrationIndex extends DiscourseRoute {
@service router;

View File

@ -1,7 +1,7 @@
import DiscourseRoute from "discourse/routes/discourse";
import Group from "discourse/models/group";
import { action } from "@ember/object";
import RSVP from "rsvp";
import Group from "discourse/models/group";
import DiscourseRoute from "discourse/routes/discourse";
export default class AdminPluginsChatIntegrationProvider extends DiscourseRoute {
model(params) {

View File

@ -1,6 +1,6 @@
import DiscourseRoute from "discourse/routes/discourse";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import DiscourseRoute from "discourse/routes/discourse";
export default class AdminPluginsChatIntegration extends DiscourseRoute {
@service router;

View File

@ -48,7 +48,7 @@
@title="chat_integration.edit_channel_modal.save"
@label="chat_integration.edit_channel_modal.save"
@action={{action "save"}}
@disabled={{(not this.validParams)}}
@disabled={{not this.validParams}}
/>
<DButton

View File

@ -6,9 +6,11 @@
<NavItem
@route="adminPlugins.chat-integration.provider"
@routeParam={{provider.name}}
@label={{(concat
"chat_integration.provider." provider.name ".title"
)}}
@label={{concat
"chat_integration.provider."
provider.name
".title"
}}
/>
{{/each}}
</ul>

View File

@ -145,7 +145,7 @@ module DiscourseChatIntegration
def self.delete_by_index(channel, index)
rules = channel.rules.order_by_precedence
return false if index < (1) || index > (rules.size)
return :deleted if rules[index - 1].destroy
:deleted if rules[index - 1].destroy
end
# Create a rule for a specific channel

View File

@ -9,7 +9,7 @@ class DiscourseChatIntegration::Rule < DiscourseChatIntegration::PluginModel
scope :with_channel_id, ->(channel_id) { where("value::json->>'channel_id'=?", channel_id.to_s) }
scope :with_category_id,
->(category_id) {
->(category_id) do
if category_id.nil?
where(
"(value::json->'category_id') IS NULL OR json_typeof(value::json->'category_id')='null'",
@ -17,13 +17,13 @@ class DiscourseChatIntegration::Rule < DiscourseChatIntegration::PluginModel
else
where("value::json->>'category_id'=?", category_id.to_s)
end
}
end
scope :with_group_ids,
->(group_id) { where("value::json->>'group_id' IN (?)", group_id.map!(&:to_s)) }
scope :order_by_precedence,
-> {
-> do
order(
"
CASE
@ -42,7 +42,7 @@ class DiscourseChatIntegration::Rule < DiscourseChatIntegration::PluginModel
END
",
)
}
end
after_initialize :init_filter

View File

@ -1,7 +1,7 @@
import { inject as service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import DiscourseRoute from "discourse/routes/discourse";
import { inject as service } from "@ember/service";
export default class Trascript extends DiscourseRoute {
@service currentUser;

View File

@ -5,6 +5,9 @@
"author": "Discourse",
"license": "MIT",
"devDependencies": {
"eslint-config-discourse": "^3.4.0"
"@discourse/lint-configs": "^1.2.0",
"ember-template-lint": "^5.13.0",
"eslint": "^8.54.0",
"prettier": "^2.8.8"
}
}

View File

@ -6,7 +6,6 @@
# version: 0.1
# url: https://github.com/discourse/discourse-chat-integration
# author: David Taylor
# transpile_js: true
enabled_site_setting :chat_integration_enabled

View File

@ -1,11 +1,11 @@
import { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers";
import { test } from "qunit";
import {
acceptance,
exists,
query,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers";
const response = (object) => {
return [200, { "Content-Type": "text/html; charset=utf-8" }, object];

1878
yarn.lock

File diff suppressed because it is too large Load Diff