From 3427dd8ca03f4710306d37b1eeae43ecb0c904d6 Mon Sep 17 00:00:00 2001
From: Kelv <kelv@discourse.org>
Date: Thu, 17 Oct 2024 17:07:32 +0800
Subject: [PATCH] DEV: Update linting setup (#56)

---
 .rubocop.yml                                  |  2 +
 .streerc                                      |  2 +
 Gemfile                                       |  8 ++
 Gemfile.lock                                  | 87 +++++++++++++++++++
 .../components/brand-header-contents.gjs      |  2 +-
 package.json                                  |  2 +-
 pnpm-lock.yaml                                | 12 +--
 7 files changed, 107 insertions(+), 8 deletions(-)
 create mode 100644 .rubocop.yml
 create mode 100644 .streerc
 create mode 100644 Gemfile
 create mode 100644 Gemfile.lock

diff --git a/.rubocop.yml b/.rubocop.yml
new file mode 100644
index 0000000..fb14dfa
--- /dev/null
+++ b/.rubocop.yml
@@ -0,0 +1,2 @@
+inherit_gem:
+  rubocop-discourse: stree-compat.yml
diff --git a/.streerc b/.streerc
new file mode 100644
index 0000000..5c47737
--- /dev/null
+++ b/.streerc
@@ -0,0 +1,2 @@
+--print-width=100
+--plugins=plugin/trailing_comma,plugin/disable_auto_ternary
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..31d8bf7
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+source "https://rubygems.org"
+
+group :development do
+  gem "rubocop-discourse"
+  gem "syntax_tree"
+end
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000..1d894dc
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,87 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    activesupport (7.2.1.1)
+      base64
+      bigdecimal
+      concurrent-ruby (~> 1.0, >= 1.3.1)
+      connection_pool (>= 2.2.5)
+      drb
+      i18n (>= 1.6, < 2)
+      logger (>= 1.4.2)
+      minitest (>= 5.1)
+      securerandom (>= 0.3)
+      tzinfo (~> 2.0, >= 2.0.5)
+    ast (2.4.2)
+    base64 (0.2.0)
+    bigdecimal (3.1.8)
+    concurrent-ruby (1.3.4)
+    connection_pool (2.4.1)
+    drb (2.2.1)
+    i18n (1.14.6)
+      concurrent-ruby (~> 1.0)
+    json (2.7.2)
+    language_server-protocol (3.17.0.3)
+    logger (1.6.1)
+    minitest (5.25.1)
+    parallel (1.26.3)
+    parser (3.3.5.0)
+      ast (~> 2.4.1)
+      racc
+    prettier_print (1.2.1)
+    racc (1.8.1)
+    rack (3.1.8)
+    rainbow (3.1.1)
+    regexp_parser (2.9.2)
+    rubocop (1.67.0)
+      json (~> 2.3)
+      language_server-protocol (>= 3.17.0)
+      parallel (~> 1.10)
+      parser (>= 3.3.0.2)
+      rainbow (>= 2.2.2, < 4.0)
+      regexp_parser (>= 2.4, < 3.0)
+      rubocop-ast (>= 1.32.2, < 2.0)
+      ruby-progressbar (~> 1.7)
+      unicode-display_width (>= 2.4.0, < 3.0)
+    rubocop-ast (1.32.3)
+      parser (>= 3.3.1.0)
+    rubocop-capybara (2.21.0)
+      rubocop (~> 1.41)
+    rubocop-discourse (3.8.2)
+      activesupport (>= 6.1)
+      rubocop (>= 1.59.0)
+      rubocop-capybara (>= 2.0.0)
+      rubocop-factory_bot (>= 2.0.0)
+      rubocop-rails (>= 2.25.0)
+      rubocop-rspec (>= 3.0.1)
+      rubocop-rspec_rails (>= 2.30.0)
+    rubocop-factory_bot (2.26.1)
+      rubocop (~> 1.61)
+    rubocop-rails (2.26.2)
+      activesupport (>= 4.2.0)
+      rack (>= 1.1)
+      rubocop (>= 1.52.0, < 2.0)
+      rubocop-ast (>= 1.31.1, < 2.0)
+    rubocop-rspec (3.1.0)
+      rubocop (~> 1.61)
+    rubocop-rspec_rails (2.30.0)
+      rubocop (~> 1.61)
+      rubocop-rspec (~> 3, >= 3.0.1)
+    ruby-progressbar (1.13.0)
+    securerandom (0.3.1)
+    syntax_tree (6.2.0)
+      prettier_print (>= 1.2.0)
+    tzinfo (2.0.6)
+      concurrent-ruby (~> 1.0)
+    unicode-display_width (2.6.0)
+
+PLATFORMS
+  arm64-darwin-23
+  ruby
+
+DEPENDENCIES
+  rubocop-discourse
+  syntax_tree
+
+BUNDLED WITH
+   2.5.21
diff --git a/javascripts/discourse/components/brand-header-contents.gjs b/javascripts/discourse/components/brand-header-contents.gjs
index 78ee375..14cb1d5 100644
--- a/javascripts/discourse/components/brand-header-contents.gjs
+++ b/javascripts/discourse/components/brand-header-contents.gjs
@@ -1,5 +1,5 @@
 import Component from "@glimmer/component";
-import { inject as service } from "@ember/service";
+import { service } from "@ember/service";
 import dIcon from "discourse-common/helpers/d-icon";
 
 export default class BrandHeaderContents extends Component {
diff --git a/package.json b/package.json
index a4caa0b..1872fa5 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "private": true,
   "devDependencies": {
-    "@discourse/lint-configs": "1.3.10",
+    "@discourse/lint-configs": "1.4.2",
     "ember-template-lint": "6.0.0",
     "eslint": "8.57.1",
     "prettier": "2.8.8",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 20857d4..a421349 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -12,8 +12,8 @@ importers:
         specifier: ^7.25.7
         version: 7.25.7(@babel/core@7.25.8)
       '@discourse/lint-configs':
-        specifier: 1.3.10
-        version: 1.3.10(ember-template-lint@6.0.0)(eslint@8.57.1)(prettier@2.8.8)
+        specifier: 1.4.2
+        version: 1.4.2(ember-template-lint@6.0.0)(eslint@8.57.1)(prettier@2.8.8)
       ember-template-lint:
         specifier: 6.0.0
         version: 6.0.0
@@ -152,11 +152,11 @@ packages:
     resolution: {integrity: sha512-JWtuCu8VQsMladxVz/P4HzHUGCAwpuqacmowgXFs5XjxIgKuNjnLokQzuVjlTvIzODaDmpjT3oxcC48vyk9EWg==}
     engines: {node: '>=6.9.0'}
 
-  '@discourse/lint-configs@1.3.10':
-    resolution: {integrity: sha512-PQ56xx4UfceLR/wJm7ig1JRNKkLVYPAeyp5bV6k6jQhpVr9TeZdobeCfGbVtKG6hhuaQ4aECPjRf/MoNw00/cw==}
+  '@discourse/lint-configs@1.4.2':
+    resolution: {integrity: sha512-AhwEfqy7ByheuNEhioXlkcgrbvzQY8yFbSWwtqAB0GXsp4UNaMZFyjdMoPFgaUDdUzjY/eKFFZ/j4FkA9EY4qA==}
     peerDependencies:
       ember-template-lint: 6.0.0
-      eslint: 8.57.0
+      eslint: 8.57.1
       prettier: 2.8.8
 
   '@ember-data/rfc395-data@0.0.4':
@@ -1947,7 +1947,7 @@ snapshots:
       '@babel/helper-validator-identifier': 7.25.7
       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:
       '@babel/core': 7.25.8
       '@babel/eslint-parser': 7.25.8(@babel/core@7.25.8)(eslint@8.57.1)