Skip to content

Commit

Permalink
chore: enable phpstan, apply fixes, bump js, format (#45)
Browse files Browse the repository at this point in the history
* chore: enable phpstan

* fix: phpstan complaints

* chore: bump js deps

* chore: prettier
  • Loading branch information
imorland authored Nov 12, 2023
1 parent ec54cf7 commit 6e13bcd
Show file tree
Hide file tree
Showing 31 changed files with 2,185 additions and 1,370 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: FoF Linguist PHP

on: [workflow_dispatch, push, pull_request]

jobs:
run:
uses: flarum/framework/.github/workflows/REUSABLE_backend.yml@main
with:
enable_backend_testing: false
enable_phpstan: true

backend_directory: .
32 changes: 0 additions & 32 deletions .github/workflows/build.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: FoF Linguist JS

on: [workflow_dispatch, push, pull_request]

jobs:
run:
uses: flarum/framework/.github/workflows/REUSABLE_frontend.yml@main
with:
enable_bundlewatch: false
enable_prettier: false
enable_typescript: false

frontend_directory: ./js
backend_directory: .
js_package_manager: npm
main_git_branch: master

secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,26 @@
},
"flagrow": {
"discuss": "https://discuss.flarum.org/d/7026"
},
"flarum-cli": {
"modules": {
"githubActions": true
}
}
},
"autoload": {
"psr-4": {
"FoF\\Linguist\\": "src/"
}
},
"require-dev": {
"flarum/phpstan": "*"
},
"scripts": {
"analyse:phpstan": "phpstan analyse",
"clear-cache:phpstan": "phpstan clear-result-cache"
},
"scripts-descriptions": {
"analyse:phpstan": "Run static analysis"
}
}
1,110 changes: 624 additions & 486 deletions js/package-lock.json

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@
"name": "@fof/linguist",
"dependencies": {
"flarum-webpack-config": "^2.0",
"webpack": "^5.76",
"webpack-cli": "^4.0"
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
},
"scripts": {
"dev": "webpack --mode development --watch",
"build": "webpack --mode production"
"build": "webpack --mode production",
"format": "prettier --write src",
"format-check": "prettier --check src"
},
"devDependencies": {
"flarum": "^0.1.0-beta.16"
"prettier": "^3.0.3",
"@flarum/prettier-config": "^1.0.0",
"flarum-tsconfig": "^1.0.2"
}
}
39 changes: 20 additions & 19 deletions js/src/admin/components/StringKey.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
import StringLocale from '../components/StringLocale';
import localesAsArray from '../utils/localesAsArray';
import highlightMithril from '../utils/highlightMithril';
import StringLocale from "../components/StringLocale";
import localesAsArray from "../utils/localesAsArray";
import highlightMithril from "../utils/highlightMithril";

/* global m */

export default class StringKey {
view(vnode) {
const {
stringKey,
highlight,
onchange,
} = vnode.attrs;
const { stringKey, highlight, onchange } = vnode.attrs;

return m('.FoF-Linguist-Key', [
m('.FoF-Linguist-Key-Code', m('code', highlightMithril(stringKey.key(), highlight))),
m('.FoF-Linguist-Locales', [
...localesAsArray().map(locale => m(StringLocale, {
key: locale.key,
locale,
stringKey,
highlight,
onchange,
})),
return m(".FoF-Linguist-Key", [
m(
".FoF-Linguist-Key-Code",
m("code", highlightMithril(stringKey.key(), highlight)),
),
m(".FoF-Linguist-Locales", [
...localesAsArray().map((locale) =>
m(StringLocale, {
key: locale.key,
locale,
stringKey,
highlight,
onchange,
}),
),
m(StringLocale, {
key: 'all',
key: "all",
locale: null,
stringKey,
highlight,
Expand Down
Loading

0 comments on commit 6e13bcd

Please sign in to comment.