Skip to content

Commit

Permalink
DEV: Update linting (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX authored Jan 15, 2024
1 parent de7d8ce commit 429c964
Show file tree
Hide file tree
Showing 15 changed files with 366 additions and 114 deletions.
File renamed without changes.
31 changes: 15 additions & 16 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,38 @@ GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
json (2.6.3)
json (2.7.1)
language_server-protocol (3.17.0.3)
parallel (1.23.0)
parser (3.2.2.4)
parallel (1.24.0)
parser (3.3.0.3)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
racc (1.7.3)
rainbow (3.1.1)
regexp_parser (2.8.2)
regexp_parser (2.9.0)
rexml (3.2.6)
rubocop (1.57.2)
rubocop (1.59.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
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)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.19.0)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-discourse (3.4.0)
rubocop (>= 1.1.0)
rubocop-rspec (>= 2.0.0)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-rspec (2.25.0)
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)
Expand All @@ -43,12 +43,11 @@ GEM
unicode-display_width (2.5.0)

PLATFORMS
arm64-darwin-21
x86_64-linux
ruby

DEPENDENCIES
rubocop-discourse
syntax_tree

BUNDLED WITH
2.4.21
2.5.4
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Ember from "ember";
import MultiSelectComponent from "select-kit/components/multi-select";
const { makeArray } = Ember;
import { computed } from "@ember/object";
import { makeArray } from "discourse-common/lib/helpers";
import MultiSelectComponent from "select-kit/components/multi-select";

export default MultiSelectComponent.extend({
classNames: ["house-ads-chooser"],
Expand Down Expand Up @@ -36,7 +35,7 @@ export default MultiSelectComponent.extend({
actions: {
onChange(value) {
const settingValue = makeArray(value).join(this.tokenSeparator);
this.attrs.onChange && this.attrs.onChange(settingValue);
this.onChange?.(settingValue);
},
},
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Controller, { inject as controller } from "@ember/controller";
import { not, or } from "@ember/object/computed";
import { inject as service } from "@ember/service";
import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { propertyNotEqual } from "discourse/lib/computed";
Expand All @@ -8,6 +9,7 @@ import I18n from "I18n";

export default Controller.extend(bufferedProperty("model"), {
adminPluginsHouseAds: controller("adminPlugins.houseAds"),
router: service(),

saving: false,
savingStatus: "",
Expand Down Expand Up @@ -71,7 +73,7 @@ export default Controller.extend(bufferedProperty("model"), {
if (!houseAds.includes(model)) {
houseAds.pushObject(model);
}
this.transitionToRoute(
this.router.transitionTo(
"adminPlugins.houseAds.show",
model.get("id")
);
Expand All @@ -96,7 +98,7 @@ export default Controller.extend(bufferedProperty("model"), {
const model = this.get("model");

if (!model.get("id")) {
this.transitionToRoute("adminPlugins.houseAds.index");
this.router.transitionTo("adminPlugins.houseAds.index");
return;
}

Expand All @@ -105,7 +107,7 @@ export default Controller.extend(bufferedProperty("model"), {
})
.then(() => {
houseAds.removeObject(model);
this.transitionToRoute("adminPlugins.houseAds.index");
this.router.transitionTo("adminPlugins.houseAds.index");
})
.catch(popupAjaxError);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import DiscourseRoute from "discourse/routes/discourse";

export default DiscourseRoute.extend({
router: service(),

@action
moreSettings() {
this.transitionTo("adminSiteSettingsCategory", "ad_plugin");
this.router.transitionTo("adminSiteSettingsCategory", "ad_plugin");
},
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<DSection @class="house-ads-settings content-body">
<section class="house-ads-settings content-body">
<div>{{i18n "admin.adplugin.house_ads.description"}}</div>

{{#if houseAds.length}}
Expand Down Expand Up @@ -37,8 +37,8 @@
<DButton
@label="admin.adplugin.house_ads.more_settings"
@icon="cog"
class="btn-default"
@action={{route-action "moreSettings"}}
class="btn-default"
/>
</form>
{{else}}
Expand All @@ -48,4 +48,4 @@
{{/link-to}}
</p>
{{/if}}
</DSection>
</section>
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<DSection @class="edit-house-ad content-body">
<h1><TextField @class="house-ad-name" @value={{buffered.name}} /></h1>
<section class="edit-house-ad content-body">
<h1><TextField @value={{buffered.name}} class="house-ad-name" /></h1>
<div class="controls">
<AceEditor @content={{buffered.html}} @mode="html" />
</div>
<div class="controls">
<div class="visibility-settings">
<div>
<Input
class="visible-to-logged-in-checkbox"
@type="checkbox"
@checked={{this.buffered.visible_to_logged_in_users}}
class="visible-to-logged-in-checkbox"
/>
<span>{{i18n "admin.adplugin.house_ads.show_to_logged_in_users"}}</span>
</div>
Expand All @@ -27,8 +27,8 @@
<DButton
@action={{action "save"}}
@disabled={{disableSave}}
class="btn-primary save-button"
@label="admin.adplugin.house_ads.save"
class="btn-primary save-button"
/>

{{#if saving}}
Expand All @@ -41,8 +41,8 @@

<DButton
@action={{action "destroy"}}
class="btn-danger delete-button"
@label="admin.adplugin.house_ads.delete"
class="btn-danger delete-button"
/>
</div>
</DSection>
</section>
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"name": "discourse-adplugin",
"version": "1.0.0",
"repository": "git@github.com:discourse/discourse-adplugin.git",
"author": "Discourse",
"license": "MIT",
"private": true,
"devDependencies": {
"@discourse/lint-configs": "^1.0.0",
"ember-template-lint": "^5.11.2",
"eslint": "^8.52.0",
"@discourse/lint-configs": "^1.3.5",
"ember-template-lint": "^5.13.0",
"eslint": "^8.56.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: 1.2.5
# authors: Vi and Sarah (@ladydanger and @cyberkoi)
# url: https://github.com/discourse/discourse-adplugin
# transpile_js: true

register_asset "stylesheets/adplugin.scss"

Expand Down
2 changes: 0 additions & 2 deletions spec/models/house_ad_setting_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "rails_helper"

describe AdPlugin::HouseAdSetting do
let(:defaults) { AdPlugin::HouseAdSetting::DEFAULTS }

Expand Down
2 changes: 0 additions & 2 deletions spec/models/house_ad_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "rails_helper"

describe AdPlugin::HouseAd do
let(:valid_attrs) do
{
Expand Down
2 changes: 0 additions & 2 deletions spec/requests/house_ad_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "rails_helper"

describe AdPlugin::HouseAdsController do
let(:admin) { Fabricate(:admin) }

Expand Down
2 changes: 0 additions & 2 deletions spec/requests/house_ad_settings_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "rails_helper"

describe AdPlugin::HouseAdSettingsController do
let(:admin) { Fabricate(:admin) }

Expand Down
2 changes: 0 additions & 2 deletions spec/requests/site_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

require "rails_helper"

RSpec.describe SiteController do
fab!(:user) { Fabricate(:user) }

Expand Down
Loading

0 comments on commit 429c964

Please sign in to comment.