DEV: Update linting (#1191)

This commit is contained in:
Jarek Radosz 2025-03-13 14:25:38 +01:00 committed by GitHub
parent 6aaf8a0619
commit ec8018333e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 1083 additions and 414 deletions

View File

@ -1,79 +1,93 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.3.4)
activesupport (8.0.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
ast (2.4.2)
base64 (0.2.0)
bigdecimal (3.1.8)
concurrent-ruby (1.3.3)
connection_pool (2.4.1)
benchmark (0.4.0)
bigdecimal (3.1.9)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
drb (2.2.1)
i18n (1.14.5)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
json (2.7.2)
language_server-protocol (3.17.0.3)
minitest (5.24.1)
mutex_m (0.2.0)
parallel (1.25.1)
parser (3.3.3.0)
json (2.10.2)
language_server-protocol (3.17.0.4)
lint_roller (1.1.0)
logger (1.6.6)
minitest (5.25.5)
parallel (1.26.3)
parser (3.3.7.1)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
racc (1.8.0)
racc (1.8.1)
rack (3.1.12)
rainbow (3.1.1)
regexp_parser (2.9.2)
rexml (3.3.9)
rubocop (1.64.1)
regexp_parser (2.10.0)
rubocop (1.74.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
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.31.1, < 2.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.38.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.1)
parser (>= 3.3.1.0)
rubocop-capybara (2.21.0)
rubocop (~> 1.41)
rubocop-discourse (3.8.1)
rubocop-capybara (2.22.1)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-discourse (3.12.1)
activesupport (>= 6.1)
rubocop (>= 1.59.0)
rubocop-capybara (>= 2.0.0)
rubocop-factory_bot (>= 2.0.0)
rubocop-rails (>= 2.25.0)
lint_roller (>= 1.1.0)
rubocop (>= 1.73.2)
rubocop-capybara (>= 2.22.0)
rubocop-factory_bot (>= 2.27.0)
rubocop-rails (>= 2.30.3)
rubocop-rspec (>= 3.0.1)
rubocop-rspec_rails (>= 2.30.0)
rubocop-factory_bot (2.26.1)
rubocop (~> 1.61)
rubocop-rails (2.25.1)
rubocop-rspec_rails (>= 2.31.0)
rubocop-factory_bot (2.27.1)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rails (2.30.3)
activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (3.0.2)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
rubocop-rspec (~> 3, >= 3.0.1)
rubocop (>= 1.72.1, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rspec (3.5.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rspec_rails (2.31.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
rubocop-rspec (~> 3.5)
ruby-progressbar (1.13.0)
securerandom (0.4.1)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
PLATFORMS
ruby
@ -83,4 +97,4 @@ DEPENDENCIES
syntax_tree
BUNDLED WITH
2.5.10
2.6.5

View File

@ -13,6 +13,7 @@
height: 1em;
opacity: 0;
display: block;
&:nth-child(1) {
width: 10%;
}
@ -92,15 +93,19 @@
&:nth-child(20) {
width: 25%;
}
&.is-shown {
opacity: 1;
}
&.show {
animation: appear 0.5s cubic-bezier(0.445, 0.05, 0.55, 0.95) 0s forwards;
@media (prefers-reduced-motion) {
animation-duration: 0s;
}
}
@media (prefers-reduced-motion: no-preference) {
&.blink {
animation: blink 0.5s cubic-bezier(0.55, 0.085, 0.68, 0.53) both;
@ -112,6 +117,7 @@
0% {
opacity: 0;
}
100% {
opacity: 1;
}
@ -121,9 +127,11 @@
0% {
opacity: 1;
}
50% {
opacity: 0.5;
}
100% {
opacity: 1;
}

View File

@ -3,6 +3,7 @@
100% {
opacity: 0;
}
50% {
opacity: 1;
}
@ -10,8 +11,8 @@
@mixin progress-dot {
content: "\25CF";
font-family: Söhne Circle, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
Cantarell, Noto Sans, sans-serif;
font-family: "Söhne Circle", system-ui, -apple-system, "Segoe UI", Roboto,
Ubuntu, Cantarell, "Noto Sans", sans-serif;
line-height: normal;
margin-left: 0.25rem;
vertical-align: baseline;
@ -44,6 +45,7 @@ article.streaming .cooked {
100% {
transform: initial;
}
30% {
transform: translateY(-0.2em);
}
@ -55,12 +57,15 @@ article.streaming .cooked {
&__dot {
display: inline-block;
@media (prefers-reduced-motion: no-preference) {
animation: ai-indicator-wave 1.8s linear infinite;
}
&:nth-child(2) {
animation-delay: -1.6s;
}
&:nth-child(3) {
animation-delay: -1.4s;
}

View File

@ -38,6 +38,7 @@ html.ai-artifact-expanded {
display: flex;
justify-content: space-between;
align-items: center;
.ai-artifact__expand-button {
margin-left: auto;
}
@ -70,14 +71,17 @@ html.ai-artifact-expanded {
background-color: var(--secondary-low);
opacity: 0.9;
transform: translateY(0);
button {
width: 100%;
text-align: left;
box-sizing: border-box;
justify-content: flex-start;
color: var(--secondary-very-high);
&:hover {
color: var(--secondary-very-high);
.d-icon {
color: var(--secondary-high);
}
@ -95,7 +99,6 @@ html.ai-artifact-expanded {
bottom: 0;
z-index: z("fullscreen");
}
position: fixed;
top: 0;
left: 0;

View File

@ -2,6 +2,7 @@
from {
opacity: 0;
}
to {
opacity: 1;
}

View File

@ -46,21 +46,26 @@
padding-left: 0.25em;
color: var(--primary-medium);
}
label {
display: block;
}
&__tool-options {
padding: 5px 10px 5px;
border: 1px solid var(--primary-low-mid);
width: 480px;
}
&__tool-options-name {
margin-bottom: 10px;
font-size: var(--font-down-1);
}
&__description {
width: 500px;
}
&__system_prompt {
width: 500px;
height: 400px;
@ -101,7 +106,7 @@
&:focus,
&:focus-within {
@include default-focus();
@include default-focus;
}
&-container {

View File

@ -40,6 +40,7 @@
.ai-tool-editor {
max-width: 80%;
position: relative;
.ace-wrapper {
border: 1px solid var(--primary-low);
max-width: 100%;
@ -47,6 +48,7 @@
width: 100%;
height: 100%;
min-height: 500px;
.ace_editor {
position: absolute;
left: 0;

View File

@ -10,6 +10,7 @@ nav.post-controls .actions button.cancel-streaming {
display: none;
}
}
.persona-llm-selector {
display: flex;
justify-content: space-between;
@ -26,6 +27,7 @@ nav.post-controls .actions button.cancel-streaming {
.gpt-persona {
margin-bottom: 5px;
}
#reply-control .composer-fields {
.mini-tag-chooser,
.add-warning {
@ -39,6 +41,7 @@ nav.post-controls .actions button.cancel-streaming {
background-color: var(--tertiary-low);
border-top: 1px solid var(--tertiary-medium);
opacity: 0.75;
.d-icon {
color: var(--tertiary);
}
@ -60,10 +63,12 @@ article.streaming nav.post-controls .actions button.cancel-streaming {
width: 100%;
min-width: 320px;
padding: 0.5em;
.d-button-label {
flex: 1;
text-align: left;
}
&:hover {
background: var(--primary-low);
}
@ -81,9 +86,11 @@ details.ai-quote {
display: flex;
justify-content: space-between;
align-items: center;
span:first-child {
margin-right: auto;
}
span:nth-child(2) {
font-size: var(--font-down-2);
background: var(--primary-medium);
@ -97,10 +104,12 @@ details.ai-quote {
.d-modal__footer {
position: relative;
padding: 10px 20px 25px;
.btn-primary {
margin-left: auto;
}
}
&__just-copied {
position: absolute;
font-size: var(--font-down-1);
@ -116,6 +125,7 @@ span.onebox-ai-llm-title {
.d-modal.ai-debug-modal {
--modal-max-width: 99%;
ul {
padding-left: 1em;
}

View File

@ -5,6 +5,7 @@
background-color: var(--success-low);
text-decoration: underline;
}
del {
background-color: var(--danger-low);
text-decoration: line-through;
@ -14,10 +15,12 @@
height: 200px;
}
}
@keyframes fadeOpacity {
0% {
opacity: 1;
}
100% {
opacity: 0.5;
}
@ -96,9 +99,11 @@
0% {
color: var(--primary);
}
50% {
color: var(--tertiary);
}
100% {
color: var(--primary);
}
@ -121,6 +126,7 @@
animation: dot-falling 1s infinite linear;
animation-delay: 0.1s;
}
.dot-falling::before,
.dot-falling::after {
content: "";
@ -128,6 +134,7 @@
position: absolute;
top: 0;
}
.dot-falling::before {
width: 10px;
height: 10px;
@ -137,6 +144,7 @@
animation: dot-falling-before 1s infinite linear;
animation-delay: 0s;
}
.dot-falling::after {
width: 10px;
height: 10px;
@ -151,44 +159,51 @@
0% {
box-shadow: 9999px -15px 0 0 rgba(152, 128, 255, 0);
}
25%,
50%,
75% {
box-shadow: 9999px 0 0 0 var(--tertiary);
}
100% {
box-shadow: 9999px 15px 0 0 rgba(152, 128, 255, 0);
}
}
@keyframes dot-falling-before {
0% {
box-shadow: 9984px -15px 0 0 rgba(152, 128, 255, 0);
}
25%,
50%,
75% {
box-shadow: 9984px 0 0 0 var(--tertiary);
}
100% {
box-shadow: 9984px 15px 0 0 rgba(152, 128, 255, 0);
}
}
@keyframes dot-falling-after {
0% {
box-shadow: 10014px -15px 0 0 rgba(152, 128, 255, 0);
}
25%,
50%,
75% {
box-shadow: 10014px 0 0 0 var(--tertiary);
}
100% {
box-shadow: 10014px 15px 0 0 rgba(152, 128, 255, 0);
}
}
// Suggest Titles Related
.showing-ai-suggestions {
.title-input {
// border on focus should be on top of suggestion button
@ -229,6 +244,7 @@
.select-kit.is-expanded {
// need to raise the z-index so the sibling input buttons don't cover the dropdown
z-index: z("dropdown") + 1;
+ button {
z-index: z("dropdown") + 1;
}
@ -267,6 +283,40 @@
// while also keeping them below the composer tips
z-index: z("composer", "dropdown") + 2;
}
.with-category .showing-ai-suggestions .category-input {
flex-wrap: nowrap;
max-width: calc(50% - 0.2em);
.category-chooser {
min-width: 0;
flex: 1 1 auto;
}
}
.with-category:not(.with-tags) {
// when tagging is disabled
.showing-ai-suggestions .category-input {
max-width: 40%;
}
}
.with-tags {
.showing-ai-suggestions .tags-input {
display: flex;
max-width: calc(50% - 0.2em);
.mini-tag-chooser {
min-width: 0;
}
}
}
.showing-ai-suggestions {
#reply-title {
padding-right: 2em;
}
}
}
.ai-category-suggester-content,
@ -333,41 +383,6 @@
}
}
// Prevent suggestion button from wrapping
#reply-control {
.with-category .showing-ai-suggestions .category-input {
flex-wrap: nowrap;
max-width: calc(50% - 0.2em);
.category-chooser {
min-width: 0;
flex: 1 1 auto;
}
}
.with-category:not(.with-tags) {
// when tagging is disabled
.showing-ai-suggestions .category-input {
max-width: 40%;
}
}
.with-tags {
.showing-ai-suggestions .tags-input {
display: flex;
max-width: calc(50% - 0.2em);
.mini-tag-chooser {
min-width: 0;
}
}
}
.showing-ai-suggestions {
#reply-title {
padding-right: 2em;
}
}
}
.suggest-tags-button + .ai-suggestions-menu {
top: 4.25rem;
}
@ -376,6 +391,7 @@
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(359deg);
}
@ -410,6 +426,7 @@
display: flex;
align-items: center;
gap: 0.5rem;
.btn {
flex-grow: 1;
padding-inline: 0;
@ -453,7 +470,6 @@
.ai-split-topic-suggestion__results {
list-style: none;
margin-left: 0;
margin: 0;
.btn {
@ -542,6 +558,7 @@
left: 0.35rem;
padding: 0.33em 0.75em;
transition: all 0.25s ease;
.discourse-no-touch & {
display: none;
}
@ -568,6 +585,7 @@
}
}
}
.discourse-no-touch & {
&:hover {
.button-wrapper .generate-caption {
@ -597,6 +615,7 @@
min-height: 3em;
height: 7em;
min-width: var(--ai-caption-popup-min-width);
@include breakpoint(tablet) {
width: 100%;
max-width: unset;
@ -613,6 +632,7 @@
font-size: var(--font-down-1);
margin-left: auto;
color: var(--tertiary);
.desktop-view & {
// a little extra space for extra narrow desktop view
@media screen and (max-width: 675px) {

View File

@ -47,9 +47,11 @@
.category-chooser {
flex: 1 1 90%;
}
.ai-category-suggester-trigger {
padding: 0.425em;
}
.ai-tag-suggester-trigger {
padding: 0.45em;
}
@ -60,10 +62,12 @@
padding-top: 0.4em;
padding-bottom: 0.4em;
}
&.ai-category-suggester-trigger {
padding-top: 0.4em;
padding-bottom: 0.25em;
}
&.ai-tag-suggester-trigger {
padding-top: 0.4em;
padding-bottom: 0.3em;

View File

@ -15,6 +15,7 @@
&__searching {
display: flex;
align-items: center;
margin-left: 5px;
&.in-progress,
&.unavailable {
@ -33,14 +34,10 @@
margin-left: 4px;
font-size: var(--font-down-1);
}
}
.semantic-search__entries {
margin-top: 10px;
}
.semantic-search__searching {
margin-left: 5px;
&__entries {
margin-top: 10px;
}
}
}
}

View File

@ -9,6 +9,10 @@
&__configured,
&__templates {
margin-top: 2em;
h2 {
font-size: var(--font-up-1);
}
}
}
@ -34,13 +38,6 @@
}
}
.ai-llms-list-editor__configured,
.ai-llms-list-editor__templates {
h2 {
font-size: var(--font-up-1);
}
}
.ai-llms-list-editor__configured {
.d-toggle-switch {
justify-content: center;
@ -54,15 +51,14 @@
tr:hover {
background: inherit;
}
@include breakpoint("tablet", min-width) {
th,
td {
&:first-child {
padding-left: 0;
}
}
th,
td {
&:last-child {
padding-right: 0;
}
@ -80,12 +76,14 @@
padding-top: 1em;
border-top: 3px solid var(--primary-low);
}
&-list-item {
display: grid;
grid-template-rows: subgrid;
grid-row: span 4;
gap: 0;
margin-bottom: 2em;
@include breakpoint("mobile-extra-large", min-width) {
margin-bottom: 3em;
}
@ -96,6 +94,7 @@
margin: 0.25em 0 0.5em;
line-height: var(--line-height-large);
align-self: start;
@include breakpoint("mobile-extra-large", min-width) {
max-width: 17em;
}
@ -118,6 +117,7 @@
list-style: none;
margin: 0.5em 0 0 0;
display: flex;
li {
font-size: var(--font-down-2);
border-radius: 0.25em;

View File

@ -2,7 +2,6 @@
--chart-response-color: rgba(75, 192, 192, 0.8);
--chart-request-color: rgba(153, 102, 255, 0.8);
--chart-cached-color: rgba(153, 102, 255, 0.4);
padding: 1em;
&__filters-dates {

View File

@ -4,6 +4,7 @@
grid-template-columns: repeat(12, 1fr);
grid-column-gap: 1em;
grid-row-gap: 1em;
.admin-report {
grid-column: span 12;
}
@ -22,7 +23,7 @@
gap: 1rem;
.filters {
@include report-container-box();
@include report-container-box;
order: 1;
width: 100%;
margin-left: 0;
@ -46,9 +47,6 @@
.control:last-child {
align-self: flex-end;
input {
}
}
.control:has(.export-csv-btn) {
@ -67,7 +65,7 @@
}
.admin-report-sentiment-analysis {
@include report-container-box();
@include report-container-box;
flex: 2;
display: flex;
gap: 2rem 1rem;
@ -138,7 +136,7 @@
}
.admin-report-sentiment-analysis-details {
@include report-container-box();
@include report-container-box;
flex: 1 1 300px;
min-width: 300px;
margin-left: 1rem;
@ -191,6 +189,7 @@
padding: 0.25rem;
font-size: var(--font-down-1);
display: inline-block;
&[data-sentiment-score="positive"] {
color: rgb(var(--d-sentiment-report-positive-rgb));
background: rgba(var(--d-sentiment-report-positive-rgb), 0.1);
@ -209,6 +208,7 @@
&__post-list {
margin-top: 1rem;
.avatar-wrapper,
.avatar-link {
width: calc(48px * 0.75);
@ -241,6 +241,7 @@
.control:first-of-type {
flex: unset;
}
.control:nth-of-type(n + 2):nth-of-type(-n + 6) {
display: none;
}

View File

@ -4,6 +4,7 @@
grid-template-areas: "icon title" "icon description";
grid-template-columns: auto 1fr;
text-align: left;
.btn__description {
grid-area: description;
width: 100%;
@ -34,22 +35,26 @@
margin-top: 0.25em;
line-height: var(--line-height-medium);
}
.excerpt {
width: 100%;
line-height: var(--line-height-large);
margin-top: 0.15em;
margin-bottom: 0.15em;
&__contents {
max-width: 70ch;
overflow-wrap: break-word;
}
}
&:not(.visited) {
.excerpt {
color: var(--primary-high);
}
}
}
.topic-excerpt {
display: none;
}

View File

@ -6,6 +6,7 @@
margin: 0;
height: 1.2em;
}
.d-button-label {
display: none;
}
@ -19,6 +20,7 @@
margin: 0;
height: 1.2em;
}
.d-button-label {
display: none;
}
@ -53,9 +55,11 @@
display: flex;
flex-direction: column;
align-items: flex-end;
button {
margin-top: 0.5em;
}
p {
color: var(--primary-medium);
}
@ -66,6 +70,7 @@
gap: 0;
grid-template-areas: "summarized regenerate" " outdated regenerate";
grid-template-columns: 1fr auto;
@include breakpoint(mobile-large) {
gap: 0.25em 0.5em;
grid-template-areas: "summarized summarized" "regenerate outdated";

View File

@ -13,7 +13,6 @@ html.scrollable-modal {
max-height: calc(
100vh - var(--header-offset) - 3rem - var(--composer-height, 0px)
);
box-shadow: var(--shadow-menu-panel);
}

View File

@ -147,9 +147,13 @@ class MoveEmbeddingsToSingleTablePerType < ActiveRecord::Migration[7.0]
SQL
begin
vector_rep = DiscourseAi::Embeddings::VectorRepresentations::Base.current_representation
DiscourseAi::Embeddings::VectorRepresentations::Base.current_representation
rescue StandardError => e
Rails.logger.error("Failed to index embeddings: #{e}")
end
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -27,4 +27,8 @@ class DropOldEmbeddingsTables < ActiveRecord::Migration[7.0]
drop_table :ai_document_fragment_embeddings_7_1
drop_table :ai_document_fragment_embeddings_8_1
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -7,7 +7,7 @@ class MigrateSentimentClassificationResultFormat < ActiveRecord::Migration[7.1]
model_used = 'cardiffnlp/twitter-roberta-base-sentiment-latest',
classification = jsonb_build_object(
'neutral', (classification->>'neutral')::float / 100,
'negative', (classification->>'negative')::float / 100,
'negative', (classification->>'negative')::float / 100,
'positive', (classification->>'positive')::float / 100
)
WHERE model_used = 'sentiment';
@ -17,7 +17,7 @@ class MigrateSentimentClassificationResultFormat < ActiveRecord::Migration[7.1]
model_used = 'j-hartmann/emotion-english-distilroberta-base',
classification = jsonb_build_object(
'sadness', (classification->>'sadness')::float / 100,
'surprise', (classification->>'surprise')::float / 100,
'surprise', (classification->>'surprise')::float / 100,
'fear', (classification->>'fear')::float / 100,
'anger', (classification->>'anger')::float / 100,
'joy', (classification->>'joy')::float / 100,
@ -27,4 +27,8 @@ class MigrateSentimentClassificationResultFormat < ActiveRecord::Migration[7.1]
WHERE model_used = 'emotion';
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
class DropAiSummariesContentRange < ActiveRecord::Migration[7.2]
DROPPED_COLUMNS ||= { ai_summaries: %i[content_range] }
DROPPED_COLUMNS = { ai_summaries: %i[content_range] }
def up
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }

View File

@ -1,10 +1,11 @@
{
"private": true,
"devDependencies": {
"@discourse/lint-configs": "2.4.0",
"@discourse/lint-configs": "2.7.0",
"ember-template-lint": "6.1.0",
"eslint": "9.19.0",
"prettier": "2.8.8"
"eslint": "9.20.1",
"prettier": "2.8.8",
"stylelint": "16.14.1"
},
"engines": {
"node": ">= 22",

1169
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

3
stylelint.config.mjs Normal file
View File

@ -0,0 +1,3 @@
export default {
extends: ["@discourse/lint-configs/stylelint"],
};