DEV: Update linting setup (#99)

This commit is contained in:
Kelv 2024-10-17 17:05:26 +08:00 committed by GitHub
parent c1201e0d1f
commit 062d4c2d12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 50 additions and 57 deletions

View File

@ -1,82 +1,79 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
activesupport (7.1.3.3) activesupport (7.2.1.1)
base64 base64
bigdecimal bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5) connection_pool (>= 2.2.5)
drb drb
i18n (>= 1.6, < 2) i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1) minitest (>= 5.1)
mutex_m securerandom (>= 0.3)
tzinfo (~> 2.0) tzinfo (~> 2.0, >= 2.0.5)
ast (2.4.2) ast (2.4.2)
base64 (0.2.0) base64 (0.2.0)
bigdecimal (3.1.8) bigdecimal (3.1.8)
concurrent-ruby (1.2.3) concurrent-ruby (1.3.4)
connection_pool (2.4.1) connection_pool (2.4.1)
drb (2.2.1) drb (2.2.1)
i18n (1.14.5) i18n (1.14.6)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
json (2.7.2) json (2.7.2)
language_server-protocol (3.17.0.3) language_server-protocol (3.17.0.3)
minitest (5.23.1) logger (1.6.1)
mutex_m (0.2.0) minitest (5.25.1)
parallel (1.24.0) parallel (1.26.3)
parser (3.3.1.0) parser (3.3.5.0)
ast (~> 2.4.1) ast (~> 2.4.1)
racc racc
prettier_print (1.2.1) prettier_print (1.2.1)
racc (1.8.0) racc (1.8.1)
rack (3.0.11) rack (3.1.8)
rainbow (3.1.1) rainbow (3.1.1)
regexp_parser (2.9.2) regexp_parser (2.9.2)
rexml (3.3.6) rubocop (1.67.0)
strscan
rubocop (1.64.0)
json (~> 2.3) json (~> 2.3)
language_server-protocol (>= 3.17.0) language_server-protocol (>= 3.17.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.3.0.2) parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0) regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0) rubocop-ast (>= 1.32.2, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0) unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3) rubocop-ast (1.32.3)
parser (>= 3.3.1.0) parser (>= 3.3.1.0)
rubocop-capybara (2.20.0) rubocop-capybara (2.21.0)
rubocop (~> 1.41) rubocop (~> 1.41)
rubocop-discourse (3.8.0) rubocop-discourse (3.8.2)
activesupport (>= 6.1) activesupport (>= 6.1)
rubocop (>= 1.59.0) rubocop (>= 1.59.0)
rubocop-capybara (>= 2.0.0) rubocop-capybara (>= 2.0.0)
rubocop-factory_bot (>= 2.0.0) rubocop-factory_bot (>= 2.0.0)
rubocop-rails (>= 2.25.0) rubocop-rails (>= 2.25.0)
rubocop-rspec (>= 2.25.0) rubocop-rspec (>= 3.0.1)
rubocop-factory_bot (2.25.1) rubocop-rspec_rails (>= 2.30.0)
rubocop (~> 1.41) rubocop-factory_bot (2.26.1)
rubocop-rails (2.25.0) rubocop (~> 1.61)
rubocop-rails (2.26.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0) rubocop (>= 1.52.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.29.2) rubocop-rspec (3.1.0)
rubocop (~> 1.40) rubocop (~> 1.61)
rubocop-capybara (~> 2.17) rubocop-rspec_rails (2.30.0)
rubocop-factory_bot (~> 2.22) rubocop (~> 1.61)
rubocop-rspec_rails (~> 2.28) rubocop-rspec (~> 3, >= 3.0.1)
rubocop-rspec_rails (2.28.3)
rubocop (~> 1.40)
ruby-progressbar (1.13.0) ruby-progressbar (1.13.0)
strscan (3.1.0) securerandom (0.3.1)
syntax_tree (6.2.0) syntax_tree (6.2.0)
prettier_print (>= 1.2.0) prettier_print (>= 1.2.0)
tzinfo (2.0.6) tzinfo (2.0.6)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0) unicode-display_width (2.6.0)
PLATFORMS PLATFORMS
ruby ruby
@ -86,4 +83,4 @@ DEPENDENCIES
syntax_tree syntax_tree
BUNDLED WITH BUNDLED WITH
2.5.10 2.5.21

View File

@ -1,6 +1,6 @@
import { tracked } from "@glimmer/tracking"; import { tracked } from "@glimmer/tracking";
import { action } from "@ember/object"; import { action } from "@ember/object";
import Service, { inject as service } from "@ember/service"; import Service, { service } from "@ember/service";
import { slugify } from "discourse/lib/utilities"; import { slugify } from "discourse/lib/utilities";
export default class TocProcessor extends Service { export default class TocProcessor extends Service {

View File

@ -1,7 +1,7 @@
{ {
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"@discourse/lint-configs": "1.3.10", "@discourse/lint-configs": "1.4.2",
"ember-template-lint": "6.0.0", "ember-template-lint": "6.0.0",
"eslint": "8.57.1", "eslint": "8.57.1",
"prettier": "2.8.8", "prettier": "2.8.8",

View File

@ -12,8 +12,8 @@ importers:
specifier: ^7.25.7 specifier: ^7.25.7
version: 7.25.7(@babel/core@7.25.8) version: 7.25.7(@babel/core@7.25.8)
'@discourse/lint-configs': '@discourse/lint-configs':
specifier: 1.3.10 specifier: 1.4.2
version: 1.3.10(ember-template-lint@6.0.0)(eslint@8.57.1)(prettier@2.8.8) version: 1.4.2(ember-template-lint@6.0.0)(eslint@8.57.1)(prettier@2.8.8)
ember-template-lint: ember-template-lint:
specifier: 6.0.0 specifier: 6.0.0
version: 6.0.0 version: 6.0.0
@ -152,11 +152,11 @@ packages:
resolution: {integrity: sha512-JWtuCu8VQsMladxVz/P4HzHUGCAwpuqacmowgXFs5XjxIgKuNjnLokQzuVjlTvIzODaDmpjT3oxcC48vyk9EWg==} resolution: {integrity: sha512-JWtuCu8VQsMladxVz/P4HzHUGCAwpuqacmowgXFs5XjxIgKuNjnLokQzuVjlTvIzODaDmpjT3oxcC48vyk9EWg==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
'@discourse/lint-configs@1.3.10': '@discourse/lint-configs@1.4.2':
resolution: {integrity: sha512-PQ56xx4UfceLR/wJm7ig1JRNKkLVYPAeyp5bV6k6jQhpVr9TeZdobeCfGbVtKG6hhuaQ4aECPjRf/MoNw00/cw==} resolution: {integrity: sha512-AhwEfqy7ByheuNEhioXlkcgrbvzQY8yFbSWwtqAB0GXsp4UNaMZFyjdMoPFgaUDdUzjY/eKFFZ/j4FkA9EY4qA==}
peerDependencies: peerDependencies:
ember-template-lint: 6.0.0 ember-template-lint: 6.0.0
eslint: 8.57.0 eslint: 8.57.1
prettier: 2.8.8 prettier: 2.8.8
'@ember-data/rfc395-data@0.0.4': '@ember-data/rfc395-data@0.0.4':
@ -1947,7 +1947,7 @@ snapshots:
'@babel/helper-validator-identifier': 7.25.7 '@babel/helper-validator-identifier': 7.25.7
to-fast-properties: 2.0.0 to-fast-properties: 2.0.0
'@discourse/lint-configs@1.3.10(ember-template-lint@6.0.0)(eslint@8.57.1)(prettier@2.8.8)': '@discourse/lint-configs@1.4.2(ember-template-lint@6.0.0)(eslint@8.57.1)(prettier@2.8.8)':
dependencies: dependencies:
'@babel/core': 7.25.8 '@babel/core': 7.25.8
'@babel/eslint-parser': 7.25.8(@babel/core@7.25.8)(eslint@8.57.1) '@babel/eslint-parser': 7.25.8(@babel/core@7.25.8)(eslint@8.57.1)

View File

@ -14,7 +14,7 @@ RSpec.describe "DiscoTOC", system: true do
:post, :post,
raw: raw:
"<div data-theme-toc='true'></div>\n\n# Heading 1\nContent for the first heading\n## Heading 2\nContent for the second heading\n### Heading 3\nContent for the third heading\n# Heading 4\nContent for the fourth heading", "<div data-theme-toc='true'></div>\n\n# Heading 1\nContent for the first heading\n## Heading 2\nContent for the second heading\n### Heading 3\nContent for the third heading\n# Heading 4\nContent for the fourth heading",
topic: topic_1 topic: topic_1,
) )
end end
@ -23,7 +23,7 @@ RSpec.describe "DiscoTOC", system: true do
:post, :post,
raw: raw:
"\n# Heading 1\nContent for the first heading\n## Heading 2\nContent for the second heading\n### Heading 3\nContent for the third heading\n# Heading 4\nContent for the fourth heading", "\n# Heading 1\nContent for the first heading\n## Heading 2\nContent for the second heading\n### Heading 3\nContent for the third heading\n# Heading 4\nContent for the fourth heading",
topic: topic_2 topic: topic_2,
) )
end end
@ -32,7 +32,7 @@ RSpec.describe "DiscoTOC", system: true do
:post, :post,
raw: raw:
"intentionally \n long \n content \n so \n there's \n plenty \n to be \n scrolled \n past \n which \n will \n force \n the \n timeline \n to \n hide \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll ", "intentionally \n long \n content \n so \n there's \n plenty \n to be \n scrolled \n past \n which \n will \n force \n the \n timeline \n to \n hide \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll ",
topic: topic_1 topic: topic_1,
) )
end end
@ -41,7 +41,7 @@ RSpec.describe "DiscoTOC", system: true do
:post, :post,
raw: raw:
"<div data-theme-toc='true'></div>\n\n# Heading For Reply 1\nContent for the first heading\n## Heading For Reply 2\nContent for the second heading\n### Heading For Reply 3\nContent for the third heading\n# Heading For Reply 4\nContent for the fourth heading", "<div data-theme-toc='true'></div>\n\n# Heading For Reply 1\nContent for the first heading\n## Heading For Reply 2\nContent for the second heading\n### Heading For Reply 3\nContent for the third heading\n# Heading For Reply 4\nContent for the fourth heading",
topic: topic_1 topic: topic_1,
) )
end end
@ -50,7 +50,7 @@ RSpec.describe "DiscoTOC", system: true do
:post, :post,
raw: raw:
"intentionally \n long \n content \n so \n there's \n plenty \n to be \n scrolled \n past \n which \n will \n force \n the \n timeline \n to \n hide \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll ", "intentionally \n long \n content \n so \n there's \n plenty \n to be \n scrolled \n past \n which \n will \n force \n the \n timeline \n to \n hide \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll \n scroll ",
topic: topic_1 topic: topic_1,
) )
end end
@ -101,21 +101,17 @@ RSpec.describe "DiscoTOC", system: true do
:post, :post,
topic: source_topic, topic: source_topic,
raw: raw:
"<div data-theme-toc='true'></div>\n\n# Heading 1 on the source topic\nContent for the first heading\n## Heading 2\nContent for the second heading\n### Heading 3\nContent for the third heading\n# Heading 4\nContent for the fourth heading\n<a href=c>Other topic</a>" "<div data-theme-toc='true'></div>\n\n# Heading 1 on the source topic\nContent for the first heading\n## Heading 2\nContent for the second heading\n### Heading 3\nContent for the third heading\n# Heading 4\nContent for the fourth heading\n<a href=c>Other topic</a>",
) )
visit("/t/#{source_topic.id}") visit("/t/#{source_topic.id}")
expect(page).to have_css( expect(page).to have_css(
".d-toc-item.d-toc-h1.active a[data-d-toc='toc-h1-heading-1-on-the-source-topic']" ".d-toc-item.d-toc-h1.active a[data-d-toc='toc-h1-heading-1-on-the-source-topic']",
) )
find("a[href='/t/#{topic_1.slug}/#{topic_1.id}'").click find("a[href='/t/#{topic_1.slug}/#{topic_1.id}'").click
expect(page).to have_css( expect(page).to have_css(".d-toc-item.d-toc-h1.active a[data-d-toc='toc-h1-heading-1']")
".d-toc-item.d-toc-h1.active a[data-d-toc='toc-h1-heading-1']" expect(page).to have_no_css("a[data-d-toc='toc-h1-heading-1-on-the-source-topic']")
)
expect(page).to have_no_css(
"a[data-d-toc='toc-h1-heading-1-on-the-source-topic']"
)
end end
it "timeline will appear without markup if auto_TOC_categories is set to the topic's category" do it "timeline will appear without markup if auto_TOC_categories is set to the topic's category" do