Merge pull request #3443 from element-hq/toger5/js-to-ts
Use `.ts` for remaining js config files
This commit is contained in:
@@ -28,8 +28,6 @@ module.exports = {
|
|||||||
rules: {
|
rules: {
|
||||||
"matrix-org/require-copyright-header": ["error", COPYRIGHT_HEADER],
|
"matrix-org/require-copyright-header": ["error", COPYRIGHT_HEADER],
|
||||||
"jsx-a11y/media-has-caption": "off",
|
"jsx-a11y/media-has-caption": "off",
|
||||||
// We should use the js-sdk logger, never console directly.
|
|
||||||
"no-console": ["error"],
|
|
||||||
"react/display-name": "error",
|
"react/display-name": "error",
|
||||||
// Encourage proper usage of Promises:
|
// Encourage proper usage of Promises:
|
||||||
"@typescript-eslint/no-floating-promises": "error",
|
"@typescript-eslint/no-floating-promises": "error",
|
||||||
@@ -46,6 +44,15 @@ module.exports = {
|
|||||||
"rxjs/no-exposed-subjects": "error",
|
"rxjs/no-exposed-subjects": "error",
|
||||||
"rxjs/finnish": ["error", { names: { "^this$": false } }],
|
"rxjs/finnish": ["error", { names: { "^this$": false } }],
|
||||||
},
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ["src/*/**"],
|
||||||
|
rules: {
|
||||||
|
// In application code we should use the js-sdk logger, never console directly.
|
||||||
|
"no-console": ["error"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
settings: {
|
settings: {
|
||||||
react: {
|
react: {
|
||||||
version: "detect",
|
version: "detect",
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
export default {
|
import type { UserConfig } from "i18next-parser";
|
||||||
|
|
||||||
|
const config: UserConfig = {
|
||||||
keySeparator: ".",
|
keySeparator: ".",
|
||||||
namespaceSeparator: false,
|
namespaceSeparator: false,
|
||||||
contextSeparator: "|",
|
contextSeparator: "|",
|
||||||
@@ -26,3 +28,5 @@ export default {
|
|||||||
input: ["src/**/*.{ts,tsx}"],
|
input: ["src/**/*.{ts,tsx}"],
|
||||||
sort: true,
|
sort: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
|
|||||||
11
knip.ts
11
knip.ts
@@ -1,8 +1,15 @@
|
|||||||
import { KnipConfig } from "knip";
|
/*
|
||||||
|
Copyright 2025 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { type KnipConfig } from "knip";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
vite: {
|
vite: {
|
||||||
config: ["vite.config.js", "vite-embedded.config.js"],
|
config: ["vite.config.ts", "vite-embedded.config.ts"],
|
||||||
},
|
},
|
||||||
entry: ["src/main.tsx", "i18next-parser.config.ts"],
|
entry: ["src/main.tsx", "i18next-parser.config.ts"],
|
||||||
ignoreBinaries: [
|
ignoreBinaries: [
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2024-2025 New Vector Ltd.
|
Copyright 2024-2025 New Vector Ltd.
|
||||||
|
|
||||||
SPDX-License-Identifier: AGPL-3.0-only
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2024 New Vector Ltd.
|
Copyright 2024-2025 New Vector Ltd.
|
||||||
|
|
||||||
SPDX-License-Identifier: AGPL-3.0-only
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2025 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
import { defineConfig, mergeConfig } from "vite";
|
import { defineConfig, mergeConfig } from "vite";
|
||||||
import fullConfig from "./vite.config";
|
|
||||||
import generateFile from "vite-plugin-generate-file";
|
import generateFile from "vite-plugin-generate-file";
|
||||||
|
|
||||||
|
import fullConfig from "./vite.config";
|
||||||
|
|
||||||
const base = "./";
|
const base = "./";
|
||||||
|
|
||||||
// Config for embedded deployments (possibly hosted under a non-root path)
|
// Config for embedded deployments (possibly hosted under a non-root path)
|
||||||
@@ -5,7 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { defineConfig, loadEnv, searchForWorkspaceRoot } from "vite";
|
import {
|
||||||
|
loadEnv,
|
||||||
|
searchForWorkspaceRoot,
|
||||||
|
type ConfigEnv,
|
||||||
|
type UserConfig,
|
||||||
|
} from "vite";
|
||||||
import svgrPlugin from "vite-plugin-svgr";
|
import svgrPlugin from "vite-plugin-svgr";
|
||||||
import { createHtmlPlugin } from "vite-plugin-html";
|
import { createHtmlPlugin } from "vite-plugin-html";
|
||||||
import { codecovVitePlugin } from "@codecov/vite-plugin";
|
import { codecovVitePlugin } from "@codecov/vite-plugin";
|
||||||
@@ -15,10 +20,14 @@ import { realpathSync } from "fs";
|
|||||||
import * as fs from "node:fs";
|
import * as fs from "node:fs";
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(({ mode, packageType }) => {
|
// Modified type helper from defineConfig to allow for packageType (see defineConfig from vite)
|
||||||
|
export default ({
|
||||||
|
mode,
|
||||||
|
packageType,
|
||||||
|
}: ConfigEnv & { packageType?: "full" | "embedded" }): UserConfig => {
|
||||||
const env = loadEnv(mode, process.cwd());
|
const env = loadEnv(mode, process.cwd());
|
||||||
// Environment variables with the VITE_ prefix are accessible at runtime.
|
// Environment variables with the VITE_ prefix are accessible at runtime.
|
||||||
// So, we set this to allow for build/package specific behaviour.
|
// So, we set this to allow for build/package specific behavior.
|
||||||
// In future we might be able to do what is needed via code splitting at
|
// In future we might be able to do what is needed via code splitting at
|
||||||
// build time.
|
// build time.
|
||||||
process.env.VITE_PACKAGE = packageType ?? "full";
|
process.env.VITE_PACKAGE = packageType ?? "full";
|
||||||
@@ -93,7 +102,7 @@ export default defineConfig(({ mode, packageType }) => {
|
|||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: {
|
||||||
assetFileNames: ({ originalFileNames }) => {
|
assetFileNames: ({ originalFileNames }): string => {
|
||||||
if (originalFileNames) {
|
if (originalFileNames) {
|
||||||
for (const name of originalFileNames) {
|
for (const name of originalFileNames) {
|
||||||
// Custom asset name for locales to include the locale code in the filename
|
// Custom asset name for locales to include the locale code in the filename
|
||||||
@@ -143,4 +152,4 @@ export default defineConfig(({ mode, packageType }) => {
|
|||||||
exclude: ["@matrix-org/matrix-sdk-crypto-wasm"],
|
exclude: ["@matrix-org/matrix-sdk-crypto-wasm"],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
};
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { defineConfig, mergeConfig } from "vitest/config";
|
import { defineConfig, mergeConfig } from "vitest/config";
|
||||||
import viteConfig from "./vite.config.js";
|
|
||||||
|
import viteConfig from "./vite.config";
|
||||||
|
|
||||||
export default defineConfig((configEnv) =>
|
export default defineConfig((configEnv) =>
|
||||||
mergeConfig(
|
mergeConfig(
|
||||||
Reference in New Issue
Block a user