Skip to content

Commit e204423

Browse files
authored
DEV: Update linting and add types (#139)
1 parent eae5319 commit e204423

15 files changed

+1043
-585
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
/gems
33
/auto_generated
4+
.eslintcache

Gemfile.lock

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,84 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
activesupport (8.0.3)
4+
activesupport (8.1.2)
55
base64
6-
benchmark (>= 0.3)
76
bigdecimal
87
concurrent-ruby (~> 1.0, >= 1.3.1)
98
connection_pool (>= 2.2.5)
109
drb
1110
i18n (>= 1.6, < 2)
11+
json
1212
logger (>= 1.4.2)
1313
minitest (>= 5.1)
1414
securerandom (>= 0.3)
1515
tzinfo (~> 2.0, >= 2.0.5)
1616
uri (>= 0.13.1)
1717
ast (2.4.3)
1818
base64 (0.3.0)
19-
benchmark (0.4.1)
20-
bigdecimal (3.3.0)
21-
concurrent-ruby (1.3.5)
22-
connection_pool (2.5.4)
19+
bigdecimal (4.0.1)
20+
concurrent-ruby (1.3.6)
21+
connection_pool (3.0.2)
2322
drb (2.2.3)
24-
i18n (1.14.7)
23+
i18n (1.14.8)
2524
concurrent-ruby (~> 1.0)
26-
json (2.15.1)
25+
json (2.18.0)
2726
language_server-protocol (3.17.0.5)
2827
lint_roller (1.1.0)
2928
logger (1.7.0)
30-
minitest (5.26.0)
29+
minitest (6.0.1)
30+
prism (~> 1.5)
3131
parallel (1.27.0)
32-
parser (3.3.9.0)
32+
parser (3.3.10.1)
3333
ast (~> 2.4.1)
3434
racc
3535
prettier_print (1.2.1)
36-
prism (1.5.1)
36+
prism (1.8.0)
3737
racc (1.8.1)
38-
rack (3.2.3)
38+
rack (3.2.4)
3939
rainbow (3.1.1)
4040
regexp_parser (2.11.3)
41-
rubocop (1.81.1)
41+
rubocop (1.84.0)
4242
json (~> 2.3)
4343
language_server-protocol (~> 3.17.0.2)
4444
lint_roller (~> 1.1.0)
4545
parallel (~> 1.10)
4646
parser (>= 3.3.0.2)
4747
rainbow (>= 2.2.2, < 4.0)
4848
regexp_parser (>= 2.9.3, < 3.0)
49-
rubocop-ast (>= 1.47.1, < 2.0)
49+
rubocop-ast (>= 1.49.0, < 2.0)
5050
ruby-progressbar (~> 1.7)
5151
unicode-display_width (>= 2.4.0, < 4.0)
52-
rubocop-ast (1.47.1)
52+
rubocop-ast (1.49.0)
5353
parser (>= 3.3.7.2)
54-
prism (~> 1.4)
54+
prism (~> 1.7)
5555
rubocop-capybara (2.22.1)
5656
lint_roller (~> 1.1)
5757
rubocop (~> 1.72, >= 1.72.1)
58-
rubocop-discourse (3.13.3)
58+
rubocop-discourse (3.14.0)
5959
activesupport (>= 6.1)
6060
lint_roller (>= 1.1.0)
61-
rubocop (>= 1.73.2)
6261
rubocop-capybara (>= 2.22.0)
62+
rubocop-discourse-base (>= 1.0.0)
6363
rubocop-factory_bot (>= 2.27.0)
6464
rubocop-rails (>= 2.30.3)
6565
rubocop-rspec (>= 3.0.1)
6666
rubocop-rspec_rails (>= 2.31.0)
67-
rubocop-factory_bot (2.27.1)
67+
rubocop-discourse-base (1.0.0)
68+
rubocop (>= 1.80.0)
69+
rubocop-factory_bot (2.28.0)
6870
lint_roller (~> 1.1)
6971
rubocop (~> 1.72, >= 1.72.1)
70-
rubocop-rails (2.33.4)
72+
rubocop-rails (2.34.3)
7173
activesupport (>= 4.2.0)
7274
lint_roller (~> 1.1)
7375
rack (>= 1.1)
7476
rubocop (>= 1.75.0, < 2.0)
7577
rubocop-ast (>= 1.44.0, < 2.0)
76-
rubocop-rspec (3.7.0)
78+
rubocop-rspec (3.9.0)
7779
lint_roller (~> 1.1)
78-
rubocop (~> 1.72, >= 1.72.1)
79-
rubocop-rspec_rails (2.31.0)
80+
rubocop (~> 1.81)
81+
rubocop-rspec_rails (2.32.0)
8082
lint_roller (~> 1.1)
8183
rubocop (~> 1.72, >= 1.72.1)
8284
rubocop-rspec (~> 3.5)
@@ -88,8 +90,8 @@ GEM
8890
concurrent-ruby (~> 1.0)
8991
unicode-display_width (3.2.0)
9092
unicode-emoji (~> 4.1)
91-
unicode-emoji (4.1.0)
92-
uri (1.0.4)
93+
unicode-emoji (4.2.0)
94+
uri (1.1.1)
9395

9496
PLATFORMS
9597
ruby
@@ -99,4 +101,4 @@ DEPENDENCIES
99101
syntax_tree
100102

101103
BUNDLED WITH
102-
2.7.2
104+
4.0.4

lib/saml_authenticator.rb

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,29 @@ def setting(key)
1818
end
1919

2020
DEFAULT_ATTRIBUTES = {
21-
"name" => ["fullName", "name"],
22-
"email" => ["email", "mail"],
23-
"first_name" => ["first_name", "firstname", "firstName"],
24-
"last_name" => ["last_name", "lastname", "lastName"],
21+
"name" => %w[fullName name],
22+
"email" => %w[email mail],
23+
"first_name" => %w[first_name firstname firstName],
24+
"last_name" => %w[last_name lastname lastName],
2525
"nickname" => ["screenName"],
2626
}
2727

2828
def request_attributes
29-
attrs = DEFAULT_ATTRIBUTES.keys | setting(:request_attributes).split("|").compact_blank.map(&:strip)
30-
attrs.map { |name| { name: , name_format: attribute_name_format, friendly_name: name } }
29+
attrs =
30+
DEFAULT_ATTRIBUTES.keys | setting(:request_attributes).split("|").compact_blank.map(&:strip)
31+
attrs.map { |name| { name:, name_format: attribute_name_format, friendly_name: name } }
3132
end
3233

3334
def attribute_statements
3435
result = Hash.new { |h, k| h[k] = [] }
3536

36-
setting(:attribute_statements).split("|").each do |statement|
37-
attrs = statement.split(":")
38-
next if attrs.size != 2 || attrs[0].blank? || attrs[1].blank?
39-
result[attrs[0].strip] |= attrs[1].split(",").compact_blank.map(&:strip)
40-
end
37+
setting(:attribute_statements)
38+
.split("|")
39+
.each do |statement|
40+
attrs = statement.split(":")
41+
next if attrs.size != 2 || attrs[0].blank? || attrs[1].blank?
42+
result[attrs[0].strip] |= attrs[1].split(",").compact_blank.map(&:strip)
43+
end
4144

4245
DEFAULT_ATTRIBUTES.each { |key, defaults| result[key] |= defaults }
4346

package.json

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
{
22
"private": true,
33
"devDependencies": {
4-
"@discourse/lint-configs": "2.32.0",
5-
"ember-template-lint": "7.9.1",
6-
"eslint": "9.37.0",
7-
"prettier": "3.6.2",
8-
"stylelint": "16.25.0"
4+
"@discourse/lint-configs": "2.37.2",
5+
"@glint/ember-tsc": "1.0.9",
6+
"concurrently": "^9.2.1",
7+
"discourse": "npm:@discourse/types@2026.1.0-2709d36",
8+
"ember-template-lint": "7.9.3",
9+
"eslint": "9.39.2",
10+
"prettier": "3.8.0",
11+
"stylelint": "17.0.0"
12+
},
13+
"scripts": {
14+
"lint": "concurrently \"pnpm:lint:*(!fix)\" --names \"lint:\"",
15+
"lint:fix": "concurrently \"pnpm:lint:*:fix\" --names \"fix:\"",
16+
"lint:css": "pnpm stylelint assets/stylesheets/**/*.scss --allow-empty-input",
17+
"lint:css:fix": "pnpm stylelint assets/stylesheets/**/*.scss --fix --allow-empty-input",
18+
"lint:js": "eslint {assets,admin/assets,test}/javascripts --cache --no-error-on-unmatched-pattern",
19+
"lint:js:fix": "eslint {assets,admin/assets,test}/javascripts --fix --no-error-on-unmatched-pattern",
20+
"lint:hbs": "ember-template-lint {assets,admin/assets,test}/javascripts/**/*.gjs --no-error-on-unmatched-pattern",
21+
"lint:hbs:fix": "ember-template-lint {assets,admin/assets,test}/javascripts/**/*.gjs --fix --no-error-on-unmatched-pattern",
22+
"lint:prettier": "pnpm prettier assets/stylesheets/**/*.scss {assets,admin/assets,test}/javascripts/**/*.{js,gjs} --check --no-error-on-unmatched-pattern",
23+
"lint:prettier:fix": "pnpm prettier assets/stylesheets/**/*.scss {assets,admin/assets,test}/javascripts/**/*.{js,gjs} -w --no-error-on-unmatched-pattern",
24+
"lint:types": "ember-tsc -b"
925
},
1026
"engines": {
1127
"node": ">= 22",
1228
"npm": "please-use-pnpm",
1329
"yarn": "please-use-pnpm",
14-
"pnpm": "9.x"
30+
"pnpm": "^10"
1531
},
16-
"packageManager": "pnpm@9.15.5"
32+
"packageManager": "pnpm@10.28.0"
1733
}

0 commit comments

Comments
 (0)