Make any typing linting opt-out instead of opt-in (#6542)

# Description of Changes
Reconfigure linting of `any` type to an opt-out instead of an opt-in
strategy now that we're close enough to everything supporting it. Also
slightly expands the scope of things included in the linting.
This commit is contained in:
James Brunton
2026-06-05 14:11:26 +00:00
committed by GitHub
parent 9ab404b2e6
commit e79f4a044f
9 changed files with 45 additions and 43 deletions
+14 -3
View File
@@ -187,12 +187,23 @@ tasks:
lint: lint:
desc: "Run linting" desc: "Run linting"
deps: [install] deps: [install]
cmds:
- task: lint:eslint
- task: lint:dpdm
lint:eslint:
desc: "Run ESLint linting"
deps: [install]
cmds: cmds:
- npx eslint --max-warnings=0 - npx eslint --max-warnings=0
# Globs (not a bare dir) so dpdm walks the whole tree — `editor/src`
# alone matched only 2 files. dpdm expands the braces itself, so this is lint:dpdm:
desc: "Run circular import linting"
deps: [install]
cmds:
# Globs so dpdm walks the whole tree. dpdm expands the braces itself, so this is
# shell-agnostic. Covers editor, portal, and the shared design system. # shell-agnostic. Covers editor, portal, and the shared design system.
- 'npx dpdm "editor/src/**/*.{ts,tsx}" "portal/src/**/*.{ts,tsx}" "shared/**/*.{ts,tsx}" --circular --no-warning --no-tree --exit-code circular:1' - npx dpdm "editor/src/**/*.{ts,tsx}" "portal/src/**/*.{ts,tsx}" "shared/**/*.{ts,tsx}" --circular --no-warning --no-tree --exit-code circular:1
lint:fix: lint:fix:
desc: "Auto-fix lint issues" desc: "Auto-fix lint issues"
+1 -1
View File
@@ -225,7 +225,7 @@ export type MaterialSymbolIcon = ${usedIcons.map((icon) => `'${icon}'`).join(" |
export interface IconSet { export interface IconSet {
prefix: string; prefix: string;
icons: Record<string, any>; icons: Record<string, unknown>;
width?: number; width?: number;
height?: number; height?: number;
} }
-5
View File
@@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import "@testing-library/jest-dom";
+2 -2
View File
@@ -99,12 +99,12 @@ Object.defineProperty(globalThis, "crypto", {
subtle: { subtle: {
digest: vi digest: vi
.fn() .fn()
.mockImplementation(async (_algorithm: string, _data: any) => { .mockImplementation(async (_algorithm: string, _data: BufferSource) => {
// Always return the mock hash buffer regardless of input // Always return the mock hash buffer regardless of input
return mockHashBuffer.slice(); return mockHashBuffer.slice();
}), }),
}, },
getRandomValues: vi.fn().mockImplementation((array: any) => { getRandomValues: vi.fn().mockImplementation((array: Uint8Array) => {
// Mock getRandomValues if needed // Mock getRandomValues if needed
for (let i = 0; i < array.length; i++) { for (let i = 0; i < array.length; i++) {
array[i] = Math.floor(Math.random() * 256); array[i] = Math.floor(Math.random() * 256);
+13 -8
View File
@@ -1,4 +1,9 @@
import { createTheme, MantineColorsTuple } from "@mantine/core"; import {
createTheme,
MantineColorsTuple,
MantineTheme,
MantineThemeComponent,
} from "@mantine/core";
// Define color tuples using CSS variables // Define color tuples using CSS variables
const primary: MantineColorsTuple = [ const primary: MantineColorsTuple = [
@@ -113,7 +118,7 @@ export const mantineTheme = createTheme({
}, },
variants: { variants: {
// Custom button variant for PDF tools // Custom button variant for PDF tools
pdfTool: (_theme: any) => ({ pdfTool: (_theme: MantineTheme) => ({
root: { root: {
backgroundColor: "var(--bg-surface)", backgroundColor: "var(--bg-surface)",
border: "1px solid var(--border-default)", border: "1px solid var(--border-default)",
@@ -125,7 +130,7 @@ export const mantineTheme = createTheme({
}, },
}), }),
}, },
} as any, } as MantineThemeComponent,
Paper: { Paper: {
styles: { styles: {
@@ -146,7 +151,7 @@ export const mantineTheme = createTheme({
}, },
}, },
Textarea: { Textarea: {
styles: (_theme: any) => ({ styles: (_theme: MantineTheme) => ({
input: { input: {
backgroundColor: "var(--bg-surface)", backgroundColor: "var(--bg-surface)",
borderColor: "var(--border-default)", borderColor: "var(--border-default)",
@@ -164,7 +169,7 @@ export const mantineTheme = createTheme({
}, },
TextInput: { TextInput: {
styles: (_theme: any) => ({ styles: (_theme: MantineTheme) => ({
input: { input: {
backgroundColor: "var(--bg-surface)", backgroundColor: "var(--bg-surface)",
borderColor: "var(--border-default)", borderColor: "var(--border-default)",
@@ -182,7 +187,7 @@ export const mantineTheme = createTheme({
}, },
PasswordInput: { PasswordInput: {
styles: (_theme: any) => ({ styles: (_theme: MantineTheme) => ({
input: { input: {
backgroundColor: "var(--bg-surface)", backgroundColor: "var(--bg-surface)",
borderColor: "var(--border-default)", borderColor: "var(--border-default)",
@@ -223,7 +228,7 @@ export const mantineTheme = createTheme({
color: "var(--text-primary)", color: "var(--text-primary)",
"--combobox-option-hover": "var(--hover-bg)", "--combobox-option-hover": "var(--hover-bg)",
"--combobox-option-selected": "var(--color-primary-100)", "--combobox-option-selected": "var(--color-primary-100)",
} as any, },
}, },
}, },
@@ -251,7 +256,7 @@ export const mantineTheme = createTheme({
color: "var(--text-primary)", color: "var(--text-primary)",
"--combobox-option-hover": "var(--hover-bg)", "--combobox-option-hover": "var(--hover-bg)",
"--combobox-option-selected": "var(--color-primary-100)", "--combobox-option-selected": "var(--color-primary-100)",
} as any, },
}, },
}, },
Tooltip: { Tooltip: {
+1 -1
View File
@@ -5,7 +5,7 @@ declare module "*.module.css";
declare module "assets/material-symbols-icons.json" { declare module "assets/material-symbols-icons.json" {
const value: { const value: {
prefix: string; prefix: string;
icons: Record<string, any>; icons: Record<string, unknown>;
width?: number; width?: number;
height?: number; height?: number;
}; };
+1 -2
View File
@@ -30,8 +30,7 @@ posthog.init(import.meta.env.VITE_PUBLIC_POSTHOG_KEY, {
function updatePosthogConsent() { function updatePosthogConsent() {
if (!posthog.__loaded) return; if (!posthog.__loaded) return;
const optIn = const optIn =
(window.CookieConsent as any)?.acceptedService?.("posthog", "analytics") || window.CookieConsent?.acceptedService?.("posthog", "analytics") || false;
false;
if (optIn) { if (optIn) {
posthog.set_config({ persistence: "localStorage+cookie" }); posthog.set_config({ persistence: "localStorage+cookie" });
posthog.opt_in_capturing(); posthog.opt_in_capturing();
-13
View File
@@ -1,13 +0,0 @@
const reportWebVitals = (onPerfEntry) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;
+13 -8
View File
@@ -143,15 +143,20 @@ export default defineConfig(
], ],
}, },
}, },
// Folders that have been cleaned up and are now conformant - stricter rules enforced here // Stricter rules that not all sub-folders are conformant to yet
{ {
files: [ files: srcGlobs,
"editor/src/desktop/**/*.{js,mjs,jsx,ts,tsx}", ignores: [
"editor/src/proprietary/**/*.{js,mjs,jsx,ts,tsx}", "editor/src/core/components/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/saas/**/*.{js,mjs,jsx,ts,tsx}", "editor/src/core/contexts/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/prototypes/**/*.{js,mjs,jsx,ts,tsx}", "editor/src/core/data/**/*.{js,mjs,jsx,ts,tsx}",
"portal/src/**/*.{js,mjs,jsx,ts,tsx}", "editor/src/core/hooks/**/*.{js,mjs,jsx,ts,tsx}",
"shared/**/*.{js,mjs,jsx,ts,tsx}", "editor/src/core/pages/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/services/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/tests/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/tools/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/types/**/*.{js,mjs,jsx,ts,tsx}",
"editor/src/core/utils/**/*.{js,mjs,jsx,ts,tsx}",
], ],
languageOptions: { languageOptions: {
parserOptions: { parserOptions: {