Skip to content

Commit

Permalink
DEV: Update linting (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX committed Jan 16, 2024
1 parent 4a30976 commit a3a272e
Show file tree
Hide file tree
Showing 12 changed files with 3,463 additions and 11 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/eslint");
11 changes: 11 additions & 0 deletions .github/workflows/discourse-plugin.yml
@@ -0,0 +1,11 @@
name: Discourse Plugin

on:
push:
branches:
- main
pull_request:

jobs:
ci:
uses: discourse/.github/.github/workflows/discourse-plugin.yml@v1
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,3 +1,3 @@
auto_generated
gems

node_modules
1 change: 1 addition & 0 deletions .prettierrc.cjs
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/prettier");
2 changes: 2 additions & 0 deletions .rubocop.yml
@@ -0,0 +1,2 @@
inherit_gem:
rubocop-discourse: stree-compat.yml
2 changes: 2 additions & 0 deletions .streerc
@@ -0,0 +1,2 @@
--print-width=100
--plugins=plugin/trailing_comma,plugin/disable_auto_ternary
1 change: 1 addition & 0 deletions .template-lintrc.cjs
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/template-lint");
8 changes: 8 additions & 0 deletions Gemfile
@@ -0,0 +1,8 @@
# frozen_string_literal: true

source "https://rubygems.org"

group :development do
gem "rubocop-discourse"
gem "syntax_tree"
end
53 changes: 53 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,53 @@
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
json (2.7.1)
language_server-protocol (3.17.0.3)
parallel (1.24.0)
parser (3.3.0.4)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
racc (1.7.3)
rainbow (3.1.1)
regexp_parser (2.9.0)
rexml (3.2.6)
rubocop (1.60.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 (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-discourse (3.6.0)
rubocop (>= 1.59.0)
rubocop-rspec (>= 2.25.0)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-rspec (2.26.1)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
unicode-display_width (2.5.0)

PLATFORMS
ruby

DEPENDENCIES
rubocop-discourse
syntax_tree

BUNDLED WITH
2.5.4
10 changes: 10 additions & 0 deletions package.json
@@ -0,0 +1,10 @@
{
"name": "discourse-jwt",
"private": true,
"devDependencies": {
"@discourse/lint-configs": "^1.3.5",
"ember-template-lint": "^5.13.0",
"eslint": "^8.56.0",
"prettier": "^2.8.8"
}
}
21 changes: 11 additions & 10 deletions plugin.rb
Expand Up @@ -6,23 +6,24 @@

gem "discourse-omniauth-jwt", "0.0.2", require: false

require 'omniauth/jwt'
require "omniauth/jwt"

class JWTAuthenticator < Auth::ManagedAuthenticator
def name
'jwt'
"jwt"
end

def register_middleware(omniauth)
omniauth.provider :jwt,
name: 'jwt',
uid_claim: 'id',
required_claims: ['id', 'email', 'name'],
setup: lambda { |env|
opts = env['omniauth.strategy'].options
opts[:secret] = SiteSetting.jwt_secret
opts[:auth_url] = SiteSetting.jwt_auth_url
}
name: "jwt",
uid_claim: "id",
required_claims: %w[id email name],
setup:
lambda { |env|
opts = env["omniauth.strategy"].options
opts[:secret] = SiteSetting.jwt_secret
opts[:auth_url] = SiteSetting.jwt_auth_url
}
end

def enabled?
Expand Down

0 comments on commit a3a272e

Please sign in to comment.