Skip to content

Commit 85b485e

Browse files
authored
DEV: Update linting config and run gjs-codemod (#376)
1 parent 5a2bfce commit 85b485e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1594
-1343
lines changed

.discourse-compatibility

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
< 3.5.0.beta5-dev: 71141cb6b274c778ad00c8f5eb17b3b6bc59dce9
12
< 3.5.0.beta1-dev: 2ba204a1de2638a7959e588b88f3b6c7fcf7a70f
23
< 3.4.0.beta2-dev: bdff229ca088ead9512ba333eea4fdbbb258b250
34
< 3.4.0.beta1-dev: 2d0dc39767f0c68d333f113c550731a5546c3137

Gemfile.lock

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,42 +14,44 @@ GEM
1414
securerandom (>= 0.3)
1515
tzinfo (~> 2.0, >= 2.0.5)
1616
uri (>= 0.13.1)
17-
ast (2.4.2)
18-
base64 (0.2.0)
19-
benchmark (0.4.0)
20-
bigdecimal (3.1.9)
17+
ast (2.4.3)
18+
base64 (0.3.0)
19+
benchmark (0.4.1)
20+
bigdecimal (3.2.0)
2121
concurrent-ruby (1.3.5)
22-
connection_pool (2.5.0)
23-
drb (2.2.1)
22+
connection_pool (2.5.3)
23+
drb (2.2.3)
2424
i18n (1.14.7)
2525
concurrent-ruby (~> 1.0)
26-
json (2.10.2)
27-
language_server-protocol (3.17.0.4)
26+
json (2.12.2)
27+
language_server-protocol (3.17.0.5)
2828
lint_roller (1.1.0)
29-
logger (1.6.6)
29+
logger (1.7.0)
3030
minitest (5.25.5)
31-
parallel (1.26.3)
32-
parser (3.3.7.1)
31+
parallel (1.27.0)
32+
parser (3.3.8.0)
3333
ast (~> 2.4.1)
3434
racc
3535
prettier_print (1.2.1)
36+
prism (1.4.0)
3637
racc (1.8.1)
37-
rack (3.1.12)
38+
rack (3.1.15)
3839
rainbow (3.1.1)
3940
regexp_parser (2.10.0)
40-
rubocop (1.74.0)
41+
rubocop (1.75.8)
4142
json (~> 2.3)
4243
language_server-protocol (~> 3.17.0.2)
4344
lint_roller (~> 1.1.0)
4445
parallel (~> 1.10)
4546
parser (>= 3.3.0.2)
4647
rainbow (>= 2.2.2, < 4.0)
4748
regexp_parser (>= 2.9.3, < 3.0)
48-
rubocop-ast (>= 1.38.0, < 2.0)
49+
rubocop-ast (>= 1.44.0, < 2.0)
4950
ruby-progressbar (~> 1.7)
5051
unicode-display_width (>= 2.4.0, < 4.0)
51-
rubocop-ast (1.38.1)
52-
parser (>= 3.3.1.0)
52+
rubocop-ast (1.44.1)
53+
parser (>= 3.3.7.2)
54+
prism (~> 1.4)
5355
rubocop-capybara (2.22.1)
5456
lint_roller (~> 1.1)
5557
rubocop (~> 1.72, >= 1.72.1)
@@ -65,13 +67,13 @@ GEM
6567
rubocop-factory_bot (2.27.1)
6668
lint_roller (~> 1.1)
6769
rubocop (~> 1.72, >= 1.72.1)
68-
rubocop-rails (2.30.3)
70+
rubocop-rails (2.32.0)
6971
activesupport (>= 4.2.0)
7072
lint_roller (~> 1.1)
7173
rack (>= 1.1)
72-
rubocop (>= 1.72.1, < 2.0)
73-
rubocop-ast (>= 1.38.0, < 2.0)
74-
rubocop-rspec (3.5.0)
74+
rubocop (>= 1.75.0, < 2.0)
75+
rubocop-ast (>= 1.44.0, < 2.0)
76+
rubocop-rspec (3.6.0)
7577
lint_roller (~> 1.1)
7678
rubocop (~> 1.72, >= 1.72.1)
7779
rubocop-rspec_rails (2.31.0)
@@ -97,4 +99,4 @@ DEPENDENCIES
9799
syntax_tree
98100

99101
BUNDLED WITH
100-
2.6.6
102+
2.6.9
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const CodeView = <template>
2+
<pre><code class={{@codeClass}}>{{@value}}</code></pre>
3+
</template>;
4+
5+
export default CodeView;

assets/javascripts/discourse/components/code-view.hbs

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/javascripts/discourse/components/data-explorer-bar-chart.js renamed to assets/javascripts/discourse/components/data-explorer-bar-chart.gjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import Component from "@glimmer/component";
2+
import { on } from "@ember/modifier";
23
import { action } from "@ember/object";
4+
import didInsert from "@ember/render-modifiers/modifiers/did-insert";
35
import { bind } from "discourse/lib/decorators";
46
import loadScript from "discourse/lib/load-script";
57
import themeColor from "../lib/themeColor";
@@ -89,4 +91,11 @@ export default class DataExplorerBarChart extends Component {
8991
this.chart.data = this.data;
9092
this.chart.update();
9193
}
94+
95+
<template>
96+
<canvas
97+
{{didInsert this.initChart}}
98+
{{on "change" this.updateChartData}}
99+
></canvas>
100+
</template>
92101
}

assets/javascripts/discourse/components/data-explorer-bar-chart.hbs

Lines changed: 0 additions & 4 deletions
This file was deleted.

assets/javascripts/discourse/components/explorer-schema.js renamed to assets/javascripts/discourse/components/explorer-schema.gjs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import Component from "@glimmer/component";
22
import { tracked } from "@glimmer/tracking";
3+
import { on } from "@ember/modifier";
34
import { action } from "@ember/object";
45
import { isBlank, isEmpty } from "@ember/utils";
6+
import ConditionalLoadingSpinner from "discourse/components/conditional-loading-spinner";
7+
import DButton from "discourse/components/d-button";
58
import { debounce } from "discourse/lib/decorators";
9+
import OneTable from "./explorer-schema/one-table";
610

711
export default class ExplorerSchema extends Component {
812
@tracked filter;
@@ -135,4 +139,38 @@ export default class ExplorerSchema extends Component {
135139
this.hideSchema = false;
136140
this.args.updateHideSchema(false);
137141
}
142+
143+
<template>
144+
{{#if this.hideSchema}}
145+
<DButton
146+
@action={{this.expandSchema}}
147+
@icon="chevron-left"
148+
class="no-text unhide"
149+
/>
150+
{{else}}
151+
<div class="schema">
152+
<div class="schema-search inline-form full-width">
153+
<input
154+
type="text"
155+
{{on "input" (action "filterChanged" value="target.value")}}
156+
/>
157+
<DButton
158+
@action={{this.collapseSchema}}
159+
@icon="chevron-right"
160+
class="no-text"
161+
/>
162+
</div>
163+
164+
<div class="schema-container">
165+
<ConditionalLoadingSpinner @condition={{this.loading}}>
166+
<ul>
167+
{{#each this.filteredTables as |table|}}
168+
<OneTable @table={{table}} />
169+
{{/each}}
170+
</ul>
171+
</ConditionalLoadingSpinner>
172+
</div>
173+
</div>
174+
{{/if}}
175+
</template>
138176
}

assets/javascripts/discourse/components/explorer-schema.hbs

Lines changed: 0 additions & 31 deletions
This file was deleted.

assets/javascripts/discourse/components/explorer-schema/enum-info.js renamed to assets/javascripts/discourse/components/explorer-schema/enum-info.gjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,14 @@ export default class EnumInfo extends Component {
77
name,
88
}));
99
}
10+
11+
<template>
12+
<ol>
13+
{{#each this.enuminfo as |enum|}}
14+
<li value={{enum.value}}>
15+
{{enum.name}}
16+
</li>
17+
{{/each}}
18+
</ol>
19+
</template>
1020
}

assets/javascripts/discourse/components/explorer-schema/enum-info.hbs

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import Component from "@glimmer/component";
2+
import { tracked } from "@glimmer/tracking";
3+
import { on } from "@ember/modifier";
4+
import icon from "discourse/helpers/d-icon";
5+
import { bind } from "discourse/lib/decorators";
6+
import { i18n } from "discourse-i18n";
7+
import EnumInfo from "./enum-info";
8+
9+
export default class OneTable extends Component {
10+
@tracked open = this.args.table.open;
11+
12+
get styles() {
13+
return this.open ? "open" : "";
14+
}
15+
16+
@bind
17+
toggleOpen() {
18+
this.open = !this.open;
19+
}
20+
21+
<template>
22+
<li class="schema-table {{this.styles}}">
23+
{{! template-lint-enable no-invalid-interactive }}
24+
<div
25+
class="schema-table-name"
26+
role="button"
27+
{{on "click" this.toggleOpen}}
28+
>
29+
{{#if this.open}}
30+
{{icon "caret-down"}}
31+
{{else}}
32+
{{icon "caret-right"}}
33+
{{/if}}
34+
{{@table.name}}
35+
</div>
36+
37+
<div class="schema-table-cols">
38+
{{#if this.open}}
39+
<dl>
40+
{{#each @table.columns as |col|}}
41+
<div>
42+
<dt
43+
class={{if col.sensitive "sensitive"}}
44+
title={{if col.sensitive (i18n "explorer.schema.sensitive")}}
45+
>
46+
{{#if col.sensitive}}
47+
{{icon "triangle-exclamation"}}
48+
{{/if}}
49+
{{col.column_name}}
50+
</dt>
51+
<dd>
52+
{{col.data_type}}
53+
{{#if col.havetypeinfo}}
54+
<br />
55+
{{#if col.havepopup}}
56+
<div class="popup-info">
57+
{{icon "info"}}
58+
<div class="popup">
59+
{{col.column_desc}}
60+
{{#if col.enum}}
61+
<EnumInfo @col={{col}} />
62+
{{/if}}
63+
</div>
64+
</div>
65+
{{/if}}
66+
<span class="schema-typenotes">
67+
{{col.notes}}
68+
</span>
69+
{{/if}}
70+
</dd>
71+
</div>
72+
{{/each}}
73+
</dl>
74+
{{/if}}
75+
</div>
76+
</li>
77+
</template>
78+
}

assets/javascripts/discourse/components/explorer-schema/one-table.hbs

Lines changed: 0 additions & 51 deletions
This file was deleted.

assets/javascripts/discourse/components/explorer-schema/one-table.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)