Add prettier ci (#163)

* Adding prettier to CI.

* Running prettier.
This commit is contained in:
Dessalines 2023-06-08 16:09:25 -04:00 committed by GitHub
parent 6a309d39d1
commit 929103ad12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 196 additions and 194 deletions

View file

@ -15,6 +15,6 @@
"plugins": [
"@babel/plugin-transform-runtime",
["babel-plugin-inferno", { "imports": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }]
]
}

View file

@ -3,13 +3,8 @@
"env": {
"browser": true
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": ["@typescript-eslint"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",

View file

@ -13,6 +13,11 @@ pipeline:
- git submodule init
- git submodule update --recursive --remote
prettier_markdown_check:
image: tmknom/prettier
commands:
- prettier -c . "!dist" "!lemmy-docs" "!lemmy-translations" "!joinlemmy-translations" "!lemmy-js-client" "!lemmy-stats-crawler"
yarn:
image: node:14-alpine
commands:

View file

@ -12,4 +12,3 @@ docker run -p 3000:1234 joinlemmy-site
```
and goto http://localhost:3000

View file

@ -1,7 +1,7 @@
import fs from 'fs';
import path from 'path';
import { exit } from 'process';
import { spawn } from 'child_process';
import fs from "fs";
import path from "path";
import { exit } from "process";
import { spawn } from "child_process";
const outDir = "src/shared/translations/";
const recommendationsFile = "recommended-instances.json";
@ -11,39 +11,51 @@ fs.mkdirSync(outDir, { recursive: true });
// crawl instance stats
try {
const recommended_instances = JSON.parse(fs.readFileSync(recommendationsFile, "utf8"));
const recommended_instances = JSON.parse(
fs.readFileSync(recommendationsFile, "utf8")
);
var all_recommended = [];
for (var k in recommended_instances) {
if (k != "exclude") {
all_recommended.push(...recommended_instances[k]);
}
}
const run = spawn("cargo",
["run", "--", "--json", "--start-instances", all_recommended,
"--exclude-instances", recommended_instances.exclude], {
const run = spawn(
"cargo",
[
"run",
"--",
"--json",
"--start-instances",
all_recommended,
"--exclude-instances",
recommended_instances.exclude,
],
{
cwd: "lemmy-stats-crawler",
encoding : 'utf8'
});
let savedOutput = '';
encoding: "utf8",
}
);
let savedOutput = "";
run.stdout.on('data', data => {
run.stdout.on("data", data => {
const strData = data.toString();
process.stdout.write(strData);
savedOutput += strData;
});
run.stderr.on('data', data => {
run.stderr.on("data", data => {
const strData = data.toString();
process.stdout.write(strData);
});
run.on('close', exitCode => {
run.on("close", exitCode => {
const stats = JSON.parse(savedOutput);
let stats2 = {
stats: stats,
recommended: recommended_instances
}
recommended: recommended_instances,
};
let data = `export const instance_stats = \n `;
data += JSON.stringify(stats2, null, 2) + ";";

View file

@ -1,5 +1,5 @@
import fs from 'fs';
import path from 'path';
import fs from "fs";
import path from "path";
const translationDir = "joinlemmy-translations/translations/";
const outDir = "src/shared/translations/";

View file

@ -10,5 +10,11 @@
"eu": ["lemmy.eus"],
"ja": ["tabinezumi.net", "lm.korako.me"],
"it": ["feddit.it"],
"exclude": ["lemmy.glasgow.social","ds9.lemmy.ml","voyager.lemmy.ml","enterprise.lemmy.ml","nrsk.no"]
"exclude": [
"lemmy.glasgow.social",
"ds9.lemmy.ml",
"voyager.lemmy.ml",
"enterprise.lemmy.ml",
"nrsk.no"
]
}

View file

@ -1,5 +1,5 @@
# Emojis, Usable Search urls, mod actions on post creators, UI Tweak
*Written by @dessalines, 2019-09-06*
_Written by @dessalines, 2019-09-06_
[Issue list on Github](https://github.com/dessalines/lemmy/milestone/10?closed=1)

View file

@ -1,5 +1,5 @@
# Image Uploads, Stickied Posts, Online Users count, View Source button
*Written by @dessalines, 2019-09-19*
_Written by @dessalines, 2019-09-19_
[Issue list on Github](https://github.com/LemmyNet/lemmy/milestone/11?closed=1)

View file

@ -1,6 +1,6 @@
# Themes, Auto-Updating front page, perma-deletes, custom rate limits
*Written by @dessalines, 2019-10-15*
_Written by @dessalines, 2019-10-15_
[Closed issues here.](https://github.com/dessalines/lemmy/milestone/12?closed=1)

View file

@ -1,6 +1,6 @@
# Username mentions, Default sorts, Vaporwave theme, Password Recovery, Arm64
*Written by @dessalines, 2019-11-02*
_Written by @dessalines, 2019-11-02_
[Lemmy Release v0.4.0](https://github.com/dessalines/lemmy/releases/tag/v0.4.0) - Username mentions, Default sorts, Vaporwave theme, Password Recovery, Arm64 support.

View file

@ -1,6 +1,6 @@
# RSS feeds, custom language, url archiving, lots of bugs fixed
*Written by @dessalines, 2019-12-09*
_Written by @dessalines, 2019-12-09_
Special thanks to @felix@radical.town for the RSS work!

View file

@ -1,6 +1,6 @@
# Avatars, email notifications, and a whole lot more
*Written by @dessalines, 2020-01-16*
_Written by @dessalines, 2020-01-16_
`v0.6.0` is here, and we've closed [41 issues!](https://github.com/dessalines/lemmy/milestone/15?closed=1)

View file

@ -1,10 +1,11 @@
# NLnet funding, and Lemmy v0.7.0 with new image hosting!
*Written by @dessalines and @nutomic, 2020-06-23*
_Written by @dessalines and @nutomic, 2020-06-23_
Let's start with the biggest news first: Lemmy is receiving funding from the [NLnet foundation](https://nlnet.nl/)! The funding is for a total amount of 45.000 €, which will allow [/u/dessalines](/u/dessalines) and me ([/u/nutomic](/u/nutomic) ) to work on Lemmy full-time for at least half a year.
We have created various milestones for the work we are planning to do. Most of them are about getting ActivityPub federation ready for production. In addition, we will work on:
- better accessibility
- private communities and instances
- reworking search
@ -15,7 +16,6 @@ The details of the milestones will be posted on our github issue tracker soon.
We're very excited about this opportunity, and can't wait to finish federation.
In other news, we have just released [Lemmy v0.7.0.](https://github.com/LemmyNet/lemmy/blob/master/RELEASES.md#lemmy-v070-release-2020-06-2x) Most importantly, this update switches to [Pict-rs](https://git.asonix.dog/asonix/pict-rs/) for image hosting, due to various performance-related issues with Pictshare. Pict-rs was coded from scratch in Rust by the amazing @asonix, who also created the ActivityPub library for Rust. We can't thank him enough for all the work he is doing for Lemmy!
We'd also like to thank the following people for their contributions:

View file

@ -1,6 +1,6 @@
# Lemmy Release v0.8.0 - Federation beta!
*Written by @dessalines and @nutomic, 2020-10-20*
_Written by @dessalines and @nutomic, 2020-10-20_
## Changes

View file

@ -1,6 +1,6 @@
# Lemmy Release v0.9.0
*Written by @dessalines and @nutomic, 2021-01-25*
_Written by @dessalines and @nutomic, 2021-01-25_
## Changes
@ -48,7 +48,6 @@ None of these are breaking changes, so federation between 0.9.0 and 0.8.11 will
- Community Titles are now used instead of names.
- Various other bug fixes.
### Lemmy Docs
- We moved documentation into a separate git repository, and support translation for the docs now!

View file

@ -1,6 +1,6 @@
# Lemmy v0.10.0 Release
*Written by @dessalines and @nutomic, 2021-04-05*
_Written by @dessalines and @nutomic, 2021-04-05_
## Changes
@ -68,11 +68,10 @@ To upgrade your instance to `v0.10.0`, simply follow the instructions in the doc
- [Upgrade with manual Docker installation](https://join.lemmy.ml/docs/en/administration/install_docker.html#updating)
- [Upgrade with Ansible installation](https://join.lemmy.ml/docs/en/administration/install_ansible.html)
## Compilation time
| | v0.9.0 (Rust 1.47) | v0.10.0 (Rust 1.47) | v0.10.0 (Rust 1.51) |
|-| -------- | -------- | -------- |
| ----------- | ------------------ | ------------------- | ------------------- |
| Clean | 140s | 146s | 119s |
| Incremental | 28s | 22s | 19s |

View file

@ -1,6 +1,6 @@
# Lemmy Release v0.11.0
*Written by @dessalines and @nutomic, 2021-04-27*
_Written by @dessalines and @nutomic, 2021-04-27_
Since our last release this month, we've had [~60](https://github.com/LemmyNet/lemmy/compare/0.10.0...main) commits to Lemmy.
@ -49,7 +49,6 @@ Since our last release this month, we've had [~60](https://github.com/LemmyNet/l
- Fix html notif bug. Fixes [#254](https://github.com/LemmyNet/lemmy-ui/issues/254)
- Fixing issue with debounce. Fixes [#236](https://github.com/LemmyNet/lemmy-ui/issues/236)
## Upgrade notes
### Servers

View file

@ -1,6 +1,6 @@
# Promoting Lemmy
*Written by @nutomic, 2021-08-09*
_Written by @nutomic, 2021-08-09_
I think most of us agree that the main problem which Lemmy has today is its lack of users. This is not for technical reasons, as we know it is quite stable and usable. The main cause is that the project is not widely known yet. In this post I will propose what we can do to change that.
@ -24,6 +24,7 @@ It is worth noting that some important features are still missing in Lemmy, part
When promoting Lemmy like this, please avoid linking to lemmy.ml directly. This instance is already too big relative to other instances, and it is not meant to be a "flagship instance" ([What is lemmy.ml?](https://lemmy.ml/post/70280)). Instead you should try to find an appropriate instance on [join-lemmy.org](https://join-lemmy.org/instances) and link to it, or link to the joinlemmy site directly. You can also explicitly encourage the creation of new instances.
On a side note, it might be worth mentioning the many ways that people can contribute to Lemmy (again depending on the audience). There are the obvious ones, like writing code for lemmy and lemmy-ui, writing documentation or translating. There are also multiple interesting options to create new projects, such as:
- Create an [alternative frontend](https://join-lemmy.org/docs/en/client_development/custom_frontend.html): nojs frontend like [lemmy-lite](https://github.com/IronOxidizer/lemmy-lite), a traditional forum frontend or something like stackoverflow
- Create a new client, be it for mobile, desktop or terminal.
- Gather instance statistics using [lemmy-stats-crawler](https://yerbamate.ml/LemmyNet/lemmy-stats-crawler), and build some nice graphs.

View file

@ -1,6 +1,6 @@
# Lemmy Release v0.12.0. User and Community blocking, lean federation, and a whole lot more
*Written by @dessalines and @nutomic, 2021-09-03*
_Written by @dessalines and @nutomic, 2021-09-03_
Since our last release in April, we've had [~80](https://github.com/LemmyNet/lemmy/compare/0.11.0...main) commits to Lemmy.
@ -8,7 +8,7 @@ Since our last release in April, we've had [~80](https://github.com/LemmyNet/lem
#### Major Changes
*Note: Issue links are below.*
_Note: Issue links are below._
- @nutomic did a major rewrite of the federation code. It is much simpler now, and reduced from 8000 lines of code to 6400. Functionality is mostly the same, but future changes will be much easier.
- You can now block users and communities, and their posts / comments won't show up in your feed.
@ -59,7 +59,6 @@ Since our last release in April, we've had [~80](https://github.com/LemmyNet/lem
- Migrate comment inReplyTo field to single value (ref [#1454](https://github.com/LemmyNet/lemmy/issues/1454))
- Fix issue with protocol string in actor id generation ([#1668](https://github.com/LemmyNet/lemmy/issues/1668))
### Lemmy UI
- Integrating resolve_user into search. ([#377](https://github.com/LemmyNet/lemmy-ui/issues/377))
@ -119,4 +118,3 @@ To upgrade your instance to `v0.12.0`, simply follow the instructions in the doc
### Clients / Apps
- A full list of the API changes can be seen on this diff of [lemmy-js-client: 0.11.0 -> 0.12.0](https://github.com/LemmyNet/lemmy-js-client/compare/0.11.0...0.12.0-rc.1) .

View file

@ -1,5 +1,5 @@
# Lemmy.ml now uses open federation
*Written by @dessalines, 2021-09-04*
_Written by @dessalines, 2021-09-04_
You no longer have to ask us to add you manually, you can subscribe and interact without the approval process.

View file

@ -1,15 +1,15 @@
# Lemmy Release v0.13.0: Comment and Post reporting are here!
*Written by @dessalines and @nutomic, 2021-09-30*
_Written by @dessalines and @nutomic, 2021-09-30_
Since our last release earlier this month, we've had [~30](https://github.com/LemmyNet/lemmy/compare/0.12.0...main) commits to Lemmy.
## Major Changes
- Added comment and post reporting in the front end, and cleaned up the reporting API.
- *Note: these are local-only currently, reports are not yet federated.*
- _Note: these are local-only currently, reports are not yet federated._
- The JWT secret is now auto-generated by the database.
- *Note: this will log out all users, so users will have to log in again.*
- _Note: this will log out all users, so users will have to log in again._
- Lots of smaller UI fixes listed below.
## Upgrade notes

View file

@ -1,6 +1,6 @@
# Lemmy Release v0.14.0: Federation with Mastodon and Pleroma
*Written by @dessalines and @nutomic, 2021-11-17*
_Written by @dessalines and @nutomic, 2021-11-17_
Today is an exciting day for the Lemmy project.

View file

@ -1,12 +1,11 @@
# Lemmy Release v0.15.1: Private instances, New User Registrations, Email Verification, and Temporary Bans
*Written by @dessalines and @nutomic, 2022-01-12*
_Written by @dessalines and @nutomic, 2022-01-12_
Lemmy now has private instances, optional registration applications, optional email verification, and temporary bans! These are described in detail below.
Special thanks to @asonix for adding [tokio-console](https://github.com/LemmyNet/Lemmy/issues/2003) and [Jaeger + opentelemetry](https://github.com/LemmyNet/Lemmy/issues/1992) to our dev setups, so we can better identify performance bottlenecks.
## What is Lemmy?
[Lemmy](https://join-lemmy.org/) is similar to sites like Reddit, Lobste.rs, or Hacker News: you subscribe to communities you're interested in, post links and discussions, then vote and comment on them. Lemmy isn't just a reddit alternative; its a network of interconnected communities ran by different people and organizations, all combining to create a single, personalized front page of your favorite news, articles, and memes.
@ -21,11 +20,11 @@ Admins can turn this on, and new users will need to verify their emails. Current
Admins can now optionally make new users fill out an application to join your server. There is a new panel in their top bar where they can approve or deny pending applications.
This works in conjunction with the *require_email* field. If that is also turned on, the application will only be shown after their email has been verified. The user will receive an email when they have been accepted.
This works in conjunction with the _require_email_ field. If that is also turned on, the application will only be shown after their email has been verified. The user will receive an email when they have been accepted.
### Closed / Private instances
The instance settings now includes a *private instance* option, which if turned on, will only let logged in users view your site. Private instances was one of our first issues, and it was a large effort, so its great to finally have this completed.
The instance settings now includes a _private instance_ option, which if turned on, will only let logged in users view your site. Private instances was one of our first issues, and it was a large effort, so its great to finally have this completed.
### Temporary Bans

View file

@ -1,6 +1,6 @@
# Lemmy v0.16.0 Release: Theming and Federation improvements (2022-03-08)
*Written by @dessalines and @nutomic, 2022-03-08*
_Written by @dessalines and @nutomic, 2022-03-08_
## What is Lemmy?
@ -31,6 +31,7 @@ Until now, only community bans were federated, and the "Remove content" option d
### Hide communities
@dayinjing implemented a funcionality for instance admins to hide controversial communities. A hidden community is only visible to those users who subscribe to it. This represents a milder alternative to removing a community. This functionality is not implemented in lemmy-ui yet, but admins can hide a community like this via command line:
```
curl -X PUT https://example.com/api/v3/community/hide \
-H "Content-Type: application/json" \
@ -46,7 +47,6 @@ It is still at an alpha level, but is very usable. We'd love to have experienced
This now makes three smartphone apps for Lemmy: [Lemmur and Jerboa for Android, and Remmel for iOS](https://join-lemmy.org/apps).
## Upgrade notes
Follow the [Docker or Ansible upgrade instructions here.](https://join-lemmy.org/docs/en/administration/administration.html)
@ -95,10 +95,9 @@ If you'd like to support development, and make sure that we will always be avail
- Alpha-ordering community follows. Fixes [#2062](https://github.com/LemmyNet/lemmy/issues/2062) ([#2079](https://github.com/LemmyNet/lemmy/issues/2079))
- Add federation tests for Friendica, improve parsing of source field (fixes [#2057](https://github.com/LemmyNet/lemmy/issues/2057)) ([#2070](https://github.com/LemmyNet/lemmy/issues/2070))
### Lemmy UI
- Rename theme files from *.min.css to *.css ([#590](https://github.com/LemmyNet/lemmy-ui/issues/590))
- Rename theme files from _.min.css to _.css ([#590](https://github.com/LemmyNet/lemmy-ui/issues/590))
- Custom themes ([#584](https://github.com/LemmyNet/lemmy-ui/issues/584))
- Add option to set site default theme (fixes [#559](https://github.com/LemmyNet/lemmy-ui/issues/559))
- Adding nofollow to links. Fixes [#542](https://github.com/LemmyNet/lemmy-ui/issues/542) ([#543](https://github.com/LemmyNet/lemmy-ui/issues/543))
@ -113,6 +112,3 @@ If you'd like to support development, and make sure that we will always be avail
- Fix report page bugs. Fixes [#558](https://github.com/LemmyNet/lemmy-ui/issues/558) ([#568](https://github.com/LemmyNet/lemmy-ui/issues/568))
- Fix post title link bug. Fixes [#547](https://github.com/LemmyNet/lemmy-ui/issues/547) ([#563](https://github.com/LemmyNet/lemmy-ui/issues/563))
- Add markdown footnotes. Fixes [#561](https://github.com/LemmyNet/lemmy-ui/issues/561) ([#562](https://github.com/LemmyNet/lemmy-ui/issues/562))

View file

@ -1,6 +1,6 @@
# Free Lemmy instance hosting
*Written by @nutomic, 2022-03-17*
_Written by @nutomic, 2022-03-17_
## What is Lemmy?

View file

@ -1,6 +1,6 @@
# Lemmy v0.16.3 Release: Federation Bug Fixes (2022-04-08)
*Written by @dessalines and @nutomic, 2022-04-08*
_Written by @dessalines and @nutomic, 2022-04-08_
## What is Lemmy?

View file

@ -1,6 +1,6 @@
# Lemmy Release v0.16.4 - Peertube federation, Rust API and other improvements (2022-05-27)
*Written by @dessalines and @nutomic, 2022-05-27*
_Written by @dessalines and @nutomic, 2022-05-27_
## What is Lemmy?

View file

@ -1,6 +1,6 @@
# Lemmy v0.16.6 Release : bug fixes (2022-07-19)
*Written by @dessalines and @nutomic, 2022-07-19*
_Written by @dessalines and @nutomic, 2022-07-19_
A few bug fixes:
@ -11,4 +11,3 @@ A few bug fixes:
- Fix length of post_report.original_post_name db field (fixes [#2311](https://github.com/LemmyNet/lemmy/issues/2311)) ([#2315](https://github.com/LemmyNet/lemmy/issues/2315))
- Add pub use for db crates in api_common ([#2305](https://github.com/LemmyNet/lemmy/issues/2305))
- Accept private like ([#1968](https://github.com/LemmyNet/lemmy/issues/1968)) ([#2301](https://github.com/LemmyNet/lemmy/issues/2301))

View file

@ -8,9 +8,7 @@
"sourceMap": true,
"moduleResolution": "node",
"lib": ["es2017", "dom"],
"types": [
"inferno"
],
"types": ["inferno"],
"jsx": "preserve",
"noUnusedLocals": true,
"baseUrl": "./src",
@ -20,8 +18,5 @@
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": [
"src/**/*",
"node_modules/inferno/dist/index.d.ts",
]
"include": ["src/**/*", "node_modules/inferno/dist/index.d.ts"]
}

View file

@ -1,9 +1,9 @@
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const nodeExternals = require('webpack-node-externals');
const CopyPlugin = require('copy-webpack-plugin');
const RunNodeWebpackPlugin = require('run-node-webpack-plugin');
const { merge } = require('lodash');
const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const nodeExternals = require("webpack-node-externals");
const CopyPlugin = require("copy-webpack-plugin");
const RunNodeWebpackPlugin = require("run-node-webpack-plugin");
const { merge } = require("lodash");
const banner = `
hash:[contentHash], chunkhash:[chunkhash], name:[name], filebase:[base], query:[query], file:[file]
@ -14,11 +14,11 @@ const banner = `
const base = {
output: {
filename: 'js/server.js',
publicPath: '/',
filename: "js/server.js",
publicPath: "/",
},
resolve: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
performance: {
hints: false,
@ -27,12 +27,12 @@ const base = {
rules: [
{
test: /\.(scss|css)$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
},
{
test: /\.(js|jsx|tsx|ts)$/, // All ts and tsx files will be process by
exclude: /node_modules/, // ignore node_modules
loader: 'babel-loader',
loader: "babel-loader",
},
// Due to some weird babel issue: https://github.com/webpack/webpack/issues/11467
{
@ -45,10 +45,10 @@ const base = {
},
plugins: [
new MiniCssExtractPlugin({
filename: 'styles/styles.css',
filename: "styles/styles.css",
}),
new CopyPlugin({
patterns: [{ from: './src/assets', to: './assets' }],
patterns: [{ from: "./src/assets", to: "./assets" }],
}),
new webpack.BannerPlugin({
banner,
@ -59,18 +59,18 @@ const base = {
const createServerConfig = (_env, mode) => {
const config = merge({}, base, {
mode,
entry: './src/server/index.tsx',
entry: "./src/server/index.tsx",
output: {
filename: 'js/server.js',
filename: "js/server.js",
},
target: 'node',
externals: [nodeExternals(), 'inferno-helmet'],
target: "node",
externals: [nodeExternals(), "inferno-helmet"],
});
if (mode === 'development') {
if (mode === "development") {
config.cache = {
type: 'filesystem',
name: 'server',
type: "filesystem",
name: "server",
};
config.plugins.push(
@ -85,16 +85,16 @@ const createServerConfig = (_env, mode) => {
const createClientConfig = (_env, mode) => {
const config = merge({}, base, {
mode,
entry: './src/client/index.tsx',
entry: "./src/client/index.tsx",
output: {
filename: 'js/client.js',
filename: "js/client.js",
},
});
if (mode === 'development') {
if (mode === "development") {
config.cache = {
type: 'filesystem',
name: 'client',
type: "filesystem",
name: "client",
};
}
@ -102,6 +102,6 @@ const createClientConfig = (_env, mode) => {
};
module.exports = (env, properties) => [
createServerConfig(env, properties.mode || 'development'),
createClientConfig(env, properties.mode || 'development'),
createServerConfig(env, properties.mode || "development"),
createClientConfig(env, properties.mode || "development"),
];