mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-09 06:03:01 -05:00
TypeScript: make vite config files strict TS compliant (#6121)
This commit is contained in:
committed by
GitHub
parent
d0f02c7272
commit
f23bcaa9d5
@@ -1,15 +1,15 @@
|
||||
import globals from 'globals';
|
||||
|
||||
import tsParser from '@typescript-eslint/parser';
|
||||
import { defineConfig } from 'eslint/config';
|
||||
import pluginImport from 'eslint-plugin-import';
|
||||
import pluginJSXA11y from 'eslint-plugin-jsx-a11y';
|
||||
import pluginReact from 'eslint-plugin-react';
|
||||
import pluginReactHooks from 'eslint-plugin-react-hooks';
|
||||
import pluginTypescript from 'typescript-eslint';
|
||||
import pluginTypescriptPaths from 'eslint-plugin-typescript-paths';
|
||||
import pluginActual from './packages/eslint-plugin-actual/lib/index.js';
|
||||
import globals from 'globals';
|
||||
import pluginTypescript from 'typescript-eslint';
|
||||
|
||||
import tsParser from '@typescript-eslint/parser';
|
||||
// eslint-disable-next-line import/extensions
|
||||
import pluginActual from './packages/eslint-plugin-actual/lib/index.js';
|
||||
|
||||
const confusingBrowserGlobals = [
|
||||
// https://github.com/facebook/create-react-app/tree/main/packages/confusing-browser-globals
|
||||
@@ -80,35 +80,28 @@ export default defineConfig(
|
||||
|
||||
'packages/api/app/bundle.api.js',
|
||||
'packages/api/app/stats.json',
|
||||
'packages/api/dist',
|
||||
'packages/api/@types',
|
||||
'packages/api/migrations',
|
||||
'packages/crdt/dist',
|
||||
'packages/component-library/src/icons/**/*',
|
||||
'packages/desktop-client/bundle.browser.js',
|
||||
'packages/desktop-client/build/',
|
||||
'packages/desktop-client/dev-dist/',
|
||||
'packages/desktop-client/service-worker/*',
|
||||
'packages/desktop-client/build-electron/',
|
||||
'packages/desktop-client/build-stats/',
|
||||
'packages/desktop-client/public/kcab/',
|
||||
'packages/desktop-client/public/data/',
|
||||
'packages/desktop-client/**/node_modules/*',
|
||||
'packages/desktop-client/node_modules/',
|
||||
'packages/desktop-client/test-results/',
|
||||
'packages/desktop-client/playwright-report/',
|
||||
'packages/desktop-electron/client-build/',
|
||||
'packages/desktop-electron/build/',
|
||||
'packages/desktop-electron/dist/',
|
||||
'packages/loot-core/**/node_modules/*',
|
||||
'packages/loot-core/**/lib-dist/*',
|
||||
'packages/loot-core/**/proto/*',
|
||||
'packages/sync-server/build/',
|
||||
'packages/sync-server/user-files/',
|
||||
'packages/sync-server/server-files/',
|
||||
'packages/plugins-service/dist/',
|
||||
'.yarn/*',
|
||||
'.github/*',
|
||||
'**/build/',
|
||||
'**/dist/',
|
||||
'**/node_modules/',
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -170,7 +163,7 @@ export default defineConfig(
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/*.{js,ts,jsx,tsx}'],
|
||||
files: ['**/*.{js,ts,jsx,tsx,mjs,mts}'],
|
||||
plugins: {
|
||||
'jsx-a11y': pluginJSXA11y,
|
||||
'react-hooks': pluginReactHooks,
|
||||
@@ -716,14 +709,18 @@ export default defineConfig(
|
||||
|
||||
// Allow configuring vitest with default exports (recommended as per vitest docs)
|
||||
{
|
||||
files: ['**/vitest.config.ts', '**/vitest.web.config.ts'],
|
||||
files: [
|
||||
'**/vitest.config.{ts,mts}',
|
||||
'**/vitest.web.config.ts',
|
||||
'**/vite.config.{ts,mts}',
|
||||
'eslint.config.mjs',
|
||||
],
|
||||
rules: {
|
||||
'import/no-anonymous-default-export': 'off',
|
||||
'import/no-default-export': 'off',
|
||||
},
|
||||
},
|
||||
|
||||
{},
|
||||
{
|
||||
// TODO: fix the issues in these files
|
||||
files: [
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-strict-ignore
|
||||
import * as path from 'path';
|
||||
|
||||
import inject from '@rollup/plugin-inject';
|
||||
@@ -6,7 +5,7 @@ import basicSsl from '@vitejs/plugin-basic-ssl';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import { visualizer } from 'rollup-plugin-visualizer';
|
||||
/// <reference types="vitest" />
|
||||
import { defineConfig, loadEnv, Plugin } from 'vite';
|
||||
import { defineConfig, loadEnv, Plugin, type UserConfig } from 'vite';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
import viteTsconfigPaths from 'vite-tsconfig-paths';
|
||||
|
||||
@@ -123,7 +122,7 @@ export default defineConfig(async ({ mode }) => {
|
||||
rollupOptions: {
|
||||
output: {
|
||||
assetFileNames: assetInfo => {
|
||||
const info = assetInfo.name.split('.');
|
||||
const info = assetInfo.name?.split('.') ?? [];
|
||||
let extType = info[info.length - 1];
|
||||
if (/png|jpe?g|svg|gif|tiff|bmp|ico/i.test(extType)) {
|
||||
extType = 'img';
|
||||
@@ -222,5 +221,6 @@ export default defineConfig(async ({ mode }) => {
|
||||
},
|
||||
maxWorkers: 2,
|
||||
},
|
||||
};
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} satisfies UserConfig & { test: any };
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-strict-ignore
|
||||
import path from 'path';
|
||||
|
||||
import { visualizer } from 'rollup-plugin-visualizer';
|
||||
@@ -7,7 +6,6 @@ import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
||||
import peggyLoader from 'vite-plugin-peggy-loader';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default defineConfig(({ mode }) => {
|
||||
const isDev = mode === 'development';
|
||||
const outDir = path.resolve(__dirname, 'lib-dist/browser');
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// @ts-strict-ignore
|
||||
import path from 'path';
|
||||
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
6
upcoming-release-notes/6121.md
Normal file
6
upcoming-release-notes/6121.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Maintenance
|
||||
authors: [MatissJanis]
|
||||
---
|
||||
|
||||
TypeScript: make vite config files strict TS compliant
|
||||
Reference in New Issue
Block a user