Run lint-staged on all new files

This commit is contained in:
Andrew Ferrazzutti
2025-02-05 09:43:21 -05:00
parent caabc37519
commit b36705c4f4
3 changed files with 47 additions and 47 deletions
+6 -6
View File
@@ -28,8 +28,8 @@ Add module configuration into `modules` section of `homeserver.yaml`:
```yaml
modules:
- module: synapse_guest_module.GuestModule
config: {}
- module: synapse_guest_module.GuestModule
config: {}
```
## Module configuration
@@ -45,10 +45,10 @@ Example configuration:
```yaml
modules:
- module: synapse_guest_module.GuestModule
config:
# Use a german suffix
display_name_suffix: ' (Gast)'
- module: synapse_guest_module.GuestModule
config:
# Use a german suffix
display_name_suffix: " (Gast)"
```
## Production installation
+19 -19
View File
@@ -1,21 +1,21 @@
{
"name": "@element-hq/synapse-guest-module",
"version": "2.0.0",
"private": true,
"description": "A synapse module to restrict the actions of guests",
"author": "New Vector Ltd.",
"license": "Apache-2.0",
"scripts": {
"clean": "echo \"Nothing to clean\"",
"build": "echo \"Nothing to build\"",
"docker:build": "docker build -t element-hq/synapse-guest-module -f Dockerfile .",
"tsc": "echo \"Nothing to tsc\"",
"lint": "echo \"Nothing to lint\"",
"types:py": "node ./scripts/run_in_venv.js tox -e check_types",
"lint:py": "node ./scripts/run_in_venv.js tox -e check_codestyle",
"lint:fix": "node ./scripts/run_in_venv.js tox -e fix_codestyle",
"test": "node ./scripts/run_in_venv.js tox -e py",
"depcheck": "echo \"Nothing to check\"",
"package": "yarn docker:build"
}
"name": "@element-hq/synapse-guest-module",
"version": "2.0.0",
"private": true,
"description": "A synapse module to restrict the actions of guests",
"author": "New Vector Ltd.",
"license": "Apache-2.0",
"scripts": {
"clean": "echo \"Nothing to clean\"",
"build": "echo \"Nothing to build\"",
"docker:build": "docker build -t element-hq/synapse-guest-module -f Dockerfile .",
"tsc": "echo \"Nothing to tsc\"",
"lint": "echo \"Nothing to lint\"",
"types:py": "node ./scripts/run_in_venv.js tox -e check_types",
"lint:py": "node ./scripts/run_in_venv.js tox -e check_codestyle",
"lint:fix": "node ./scripts/run_in_venv.js tox -e fix_codestyle",
"test": "node ./scripts/run_in_venv.js tox -e py",
"depcheck": "echo \"Nothing to check\"",
"package": "yarn docker:build"
}
}
@@ -21,39 +21,39 @@
//
// Example: $ node ./run_in_venv.js python --version
const fs = require('fs');
const path = require('path');
const child_process = require('child_process');
const fs = require("fs");
const path = require("path");
const child_process = require("child_process");
const cwd = path.resolve(__dirname, '..');
const venvPath = path.resolve(__dirname, '../../../.venv');
const cwd = path.resolve(__dirname, "..");
const venvPath = path.resolve(__dirname, "../../../.venv");
const venvRelativeToCwd = path.relative(cwd, venvPath);
function run(command) {
return new Promise((resolve) => {
const proc = child_process.spawn(
`source ${venvRelativeToCwd}/bin/activate && ${command}`,
[],
{ cwd, stdio: 'inherit', shell: true },
);
return new Promise((resolve) => {
const proc = child_process.spawn(`source ${venvRelativeToCwd}/bin/activate && ${command}`, [], {
cwd,
stdio: "inherit",
shell: true,
});
proc.on('close', (code) => {
console.log('command terminated:', code);
resolve();
proc.on("close", (code) => {
console.log("command terminated:", code);
resolve();
});
});
});
}
async function main() {
if (!fs.existsSync(venvPath) || !fs.lstatSync(venvPath).isDirectory()) {
child_process.execSync(`python3 -m venv ${venvRelativeToCwd}`, { cwd });
await run('pip install tox');
await run('pip install -e ."[dev]"');
}
if (!fs.existsSync(venvPath) || !fs.lstatSync(venvPath).isDirectory()) {
child_process.execSync(`python3 -m venv ${venvRelativeToCwd}`, { cwd });
await run("pip install tox");
await run('pip install -e ."[dev]"');
}
const command = process.argv.slice(2).join(' ');
const command = process.argv.slice(2).join(" ");
await run(command);
await run(command);
}
main();