diff --git a/ivette/.eslintrc.js b/ivette/.eslintrc.js index 4244c156a8043cd71bedb279b7c2d9d04fe240b9..ab1a65a5d6291ace7828dc509221d216d1577b17 100644 --- a/ivette/.eslintrc.js +++ b/ivette/.eslintrc.js @@ -29,7 +29,11 @@ module.exports = { // Do not allow functions without return type, except function expressions (arrow functions) "@typescript-eslint/explicit-function-return-type": [ "error", - { allowExpressions: true } + { + allowExpressions: true, + allowTypedFunctionExpressions: true, + allowConciseArrowFunctionExpressionsStartingWithVoid: true + } ], // Prefer const when _all_ destructured values may be const "prefer-const": [ @@ -44,6 +48,9 @@ module.exports = { "object-curly-newline": ["error", { "multiline": true }], // Allow infinite loops but disallow constant if-then-else "no-constant-condition": ["error", { "checkLoops": false }], + // Disallow explicit any types ; common workaround includes using 'unknown' + // when the type can't be infered + "@typescript-eslint/no-explicit-any": "error", // --- Safety rules --- @@ -60,7 +67,8 @@ module.exports = { "vars": "local", "ignoreRestSiblings": true, // Useful to remove properties using rest properties "varsIgnorePattern": "^_", - "argsIgnorePattern": "^_" } + "argsIgnorePattern": "^_" + } ], // Disallow the use of var in favor of let and const "no-var": "error", diff --git a/ivette/src/dome/.eslintrc.json b/ivette/src/dome/.eslintrc.json deleted file mode 100644 index fb24a7a0c7575b4542d30ec947c809f3bc8332a0..0000000000000000000000000000000000000000 --- a/ivette/src/dome/.eslintrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "rules": { - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-function-return-type": "off" - } -} \ No newline at end of file diff --git a/ivette/src/dome/main/dome.ts b/ivette/src/dome/main/dome.ts index 8aa0d1dffa1b8e60cba69a597496ffa670c0d7fa..642bdd3375338974d9fe33997fa1a8f7fc8a2003 100644 --- a/ivette/src/dome/main/dome.ts +++ b/ivette/src/dome/main/dome.ts @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + /** ## Dome Application (Main Process) @@ -136,7 +138,7 @@ function obtainGlobalSettings() { // --- Window Settings & Frames // -------------------------------------------------------------------------- -type Store = { [key: string]: any }; +type Store = { [key: string]: unknown }; interface Handle { window: BrowserWindow; // Also prevents Gc @@ -175,7 +177,7 @@ ipcMain.on('dome.ipc.settings.sync', windowSyncSettings); // --- Patching Settings // -------------------------------------------------------------------------- -type Patch = { key: string; value: any }; +type Patch = { key: string; value: unknown }; function applyPatches(data: Store, args: Patch[]) { args.forEach(({ key, value }) => { @@ -222,7 +224,7 @@ ipcMain.on('dome.ipc.settings.storage', applyStorageSettings); // --- Renderer-Process Communication // -------------------------------------------------------------------------- -function broadcast(event: string, ...args: any[]) { +function broadcast(event: string, ...args: unknown[]) { BrowserWindow.getAllWindows().forEach((w) => { w.webContents.send(event, ...args); }); @@ -340,7 +342,7 @@ function createBrowserWindow( const { frame, devtools, settings = {}, storage = {} } = configData; if (frame) { - const getInt = (v: any) => v && _.toSafeInteger(v); + const getInt = <A>(v: A) => v && _.toSafeInteger(v); options.x = getInt(frame.x); options.y = getInt(frame.y); options.width = getInt(frame.width); diff --git a/ivette/src/dome/main/menubar.ts b/ivette/src/dome/main/menubar.ts index ee337d568b02d50ebed7261ac6c29b74f9d332cc..5ea586aeb622f1a41113a854c5e23fa48edf5c31 100644 --- a/ivette/src/dome/main/menubar.ts +++ b/ivette/src/dome/main/menubar.ts @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Menus & MenuBar Management // -------------------------------------------------------------------------- diff --git a/ivette/src/dome/misc/system.ts b/ivette/src/dome/misc/system.ts index 32f9f791e638f162eef39a887f829debeba1f3da..c19e41c40668d77abf155e6263a854fde87b153a 100644 --- a/ivette/src/dome/misc/system.ts +++ b/ivette/src/dome/misc/system.ts @@ -98,12 +98,12 @@ const exitJobs: Callback[] = []; Exceptions thrown by the function are captured and reported on the console. */ -export function atExit(callback: Callback) { +export function atExit(callback: Callback): void { exitJobs.push(callback); } /** Execute all pending exit jobs (and flush the list). */ -export function doExit() { +export function doExit(): void { exitJobs.forEach((fn) => { try { fn(); } catch (err) { console.error('[Dome] atExit:', err); } @@ -118,7 +118,7 @@ export function doExit() { let COMMAND_WDIR = '.'; let COMMAND_ARGV: string[] = []; -function setCommandLine(argv: string[], wdir: string) { +function setCommandLine(argv: string[], wdir: string): void { COMMAND_ARGV = argv; COMMAND_WDIR = wdir; } @@ -134,12 +134,12 @@ function setCommandLine(argv: string[], wdir: string) { See also [[dome.onCommand]] */ -export function getWorkingDir() { return COMMAND_WDIR; } +export function getWorkingDir(): string { return COMMAND_WDIR; } /** Returns the current process ID. */ -export function getPID() { return process.pid; } +export function getPID(): number { return process.pid; } /** Command-line arguments (Application Window). @@ -151,7 +151,7 @@ export function getPID() { return process.pid; } See also [[dome.onCommand]] */ -export function getArguments() { return COMMAND_ARGV; } +export function getArguments(): string[] { return COMMAND_ARGV; } // -------------------------------------------------------------------------- // --- File Join @@ -232,9 +232,9 @@ export function fileStat(path: string): Promise<fs.Stats> { Checks if a path exists and is a regular file (Synchronous check). */ -export function isFile(path: string) { +export function isFile(path: string): boolean { try { - return path && fs.statSync(path).isFile(); + return !!path && fs.statSync(path).isFile(); } catch (_err) { return false; } @@ -244,9 +244,9 @@ export function isFile(path: string) { Checks if a path exists and is a directory (Synchronous check). */ -export function isDirectory(path: string) { +export function isDirectory(path: string): boolean { try { - return path && fs.statSync(path).isDirectory(); + return !!path && fs.statSync(path).isDirectory(); } catch (_err) { return false; } @@ -256,7 +256,7 @@ export function isDirectory(path: string) { Checks if a path exists and is a file or directory (Synchronous check). */ -export function exists(path: string) { +export function exists(path: string): boolean { try { if (!path) return false; const stats = fs.statSync(path); @@ -321,7 +321,7 @@ export async function copyFile(srcPath: string, tgtPath: string): Promise<void> On MacOS, `.DS_Store` entries are filtered out. */ export async function readDir(path: string): Promise<string[]> { - const filterDir = (f: string) => f !== '.DS_Store'; + const filterDir = (f: string): boolean => f !== '.DS_Store'; const entries = await fs.promises.readdir(path, { encoding: 'utf-8', withFileTypes: true }); return entries.map((fn) => fn.name).filter(filterDir); } @@ -389,7 +389,7 @@ async function rmDirRec(path: string): Promise<void> { return; } if (stats.isDirectory()) { - const rmDirSub = (name: string) => { + const rmDirSub = (name: string): void => { rmDirRec(fspath.join(path, name)); }; const entries = await readDir(path); @@ -476,7 +476,7 @@ interface Readable { unpipe(out: fs.WriteStream): void; } -function pipeTee(std: Readable, fd: number) { +function pipeTee(std: Readable, fd: number): void { if (!fd) return; const out = fs.createWriteStream('<ignored>', { fd, encoding: 'utf-8' }); out.on('error', (err) => { diff --git a/ivette/src/dome/renderer/controls/buttons.tsx b/ivette/src/dome/renderer/controls/buttons.tsx index 6e47c4e88b3493f5dd0afd4fdd419939cea99911..d98c35681a82e10a385b078612ab7ae5b44ddc9c 100644 --- a/ivette/src/dome/renderer/controls/buttons.tsx +++ b/ivette/src/dome/renderer/controls/buttons.tsx @@ -38,7 +38,7 @@ interface EVENT { stopPropagation: () => void; } -const DISABLED = ({ disabled = false, enabled = true }) => ( +const DISABLED = ({ disabled = false, enabled = true }): boolean => ( !!disabled || !enabled ); @@ -59,7 +59,7 @@ interface LABELprops { label: string; } -const LABEL = ({ disabled, label }: LABELprops) => ( +const LABEL = ({ disabled, label }: LABELprops): JSX.Element => ( <div className="dome-xButton-label"> <div className="dome-xButton-label dome-control-enabled" @@ -122,7 +122,7 @@ export interface ButtonProps { } /** Standard button. */ -export function Button(props: ButtonProps) { +export function Button(props: ButtonProps): JSX.Element { const disabled = props.onClick ? DISABLED(props) : true; const { focusable = false, kind = 'default', @@ -160,7 +160,7 @@ export function Button(props: ButtonProps) { // -------------------------------------------------------------------------- /** Circled Icon Button. The label property is ignored. */ -export const CircButton = (props: ButtonProps) => { +export const CircButton = (props: ButtonProps): JSX.Element => { const disabled = props.onClick ? DISABLED(props) : true; const { focusable = false, kind = 'default', @@ -238,7 +238,7 @@ export interface IconButtonProps { } /** Borderless Icon Button. Label property is ignored. */ -export function IconButton(props: IconButtonProps) { +export function IconButton(props: IconButtonProps): JSX.Element | null { const disabled = props.onClick ? DISABLED(props) : true; const { icon, title, className, @@ -294,7 +294,7 @@ export interface CheckProps { } /** Checkbox button. */ -export const Checkbox = (props: CheckProps) => { +export const Checkbox = (props: CheckProps): JSX.Element => { const { value, onChange } = props; const disabled = onChange ? DISABLED(props) : true; const callback = onChange && (() => onChange(!value)); @@ -318,7 +318,7 @@ export const Checkbox = (props: CheckProps) => { }; /** Switch button. */ -export const Switch = (props: CheckProps) => { +export const Switch = (props: CheckProps): JSX.Element => { const { onChange, value } = props; const disabled = onChange ? DISABLED(props) : true; const iconId = props.value ? 'SWITCH.ON' : 'SWITCH.OFF'; @@ -367,7 +367,7 @@ export interface RadioProps<A> { } /** Radio Button. See also [[RadioGroup]]. */ -export function Radio<A>(props: RadioProps<A>) { +export function Radio<A>(props: RadioProps<A>): JSX.Element { const { onSelection, value, selection } = props; const disabled = onSelection ? DISABLED(props) : true; const checked = value === selection; @@ -427,7 +427,7 @@ export interface RadioGroupProps<A> { The radio buttons inside a group are laidout in a vertical box with the additional styling properties. */ -export function RadioGroup<A>(props: RadioGroupProps<A>) { +export function RadioGroup<A>(props: RadioGroupProps<A>): JSX.Element { const { className = '', style, @@ -435,15 +435,16 @@ export function RadioGroup<A>(props: RadioGroupProps<A>) { onChange: onGroupSelect, } = props; const disabledGroup = onGroupSelect ? DISABLED(props) : true; - const makeRadio = (elt: any) => { - const radioProps = elt.props as RadioProps<A>; + const makeRadio = (elt: unknown): JSX.Element => { + const typedElt = elt as React.ReactElement<RadioProps<A>>; + const radioProps = typedElt.props; const disabled = disabledGroup || DISABLED(radioProps); const { onSelection: onRadioSelect } = radioProps; - const onSelection = (v: A) => { + const onSelection = (v: A): void => { if (onRadioSelect) onRadioSelect(v); if (onGroupSelect) onGroupSelect(v); }; - return React.cloneElement(elt, { + return React.cloneElement(typedElt, { disabled, enabled: !disabled, selection, @@ -495,14 +496,14 @@ export interface SelectProps { * <option value='…' disabled=… >…</option> */ -export function Select(props: SelectProps) { +export function Select(props: SelectProps): JSX.Element { const { onChange, placeholder } = props; const className = classes( 'dome-xSelect dome-xBoxButton dome-xButton-default dome-xButton-label', props.className, ); const disabled = onChange ? DISABLED(props) : true; - const callback = (evt: React.ChangeEvent<HTMLSelectElement>) => { + const callback = (evt: React.ChangeEvent<HTMLSelectElement>): void => { if (onChange) onChange(evt.target.value); }; return ( @@ -553,17 +554,17 @@ export interface FieldProps { /** Text Field. */ -export const Field = (props: FieldProps) => { +export const Field = (props: FieldProps): JSX.Element => { const [current, setCurrent] = React.useState<string>(); const { className = '', onChange, onEdited, value = '' } = props; const disabled = onChange ? DISABLED(props) : true; const theValue = current ?? value; - const ONCHANGE = (evt: React.ChangeEvent<HTMLInputElement>) => { + const ONCHANGE = (evt: React.ChangeEvent<HTMLInputElement>): void => { const text = evt.target.value || ''; setCurrent(text); if (onEdited) onEdited(text); }; - const ONKEYPRESS = (evt: React.KeyboardEvent) => { + const ONKEYPRESS = (evt: React.KeyboardEvent): void => { switch (evt.key) { case 'Enter': setCurrent(undefined); diff --git a/ivette/src/dome/renderer/controls/displays.tsx b/ivette/src/dome/renderer/controls/displays.tsx index 1a0586bc6db844d6f8d6b0faa22d59e8d7c6cac3..4b25717892faf47244fda26300747f851842656c 100644 --- a/ivette/src/dome/renderer/controls/displays.tsx +++ b/ivette/src/dome/renderer/controls/displays.tsx @@ -40,7 +40,7 @@ import './style.css'; // -------------------------------------------------------------------------- /** Button-like label. */ -export function LCD(props: LabelProps) { +export function LCD(props: LabelProps): JSX.Element { const className = classes( 'dome-xButton dome-xBoxButton dome-text-code dome-xButton-lcd ', props.className, @@ -85,7 +85,7 @@ export interface LEDprops { style?: React.CSSProperties; } -export const LED = (props: LEDprops) => { +export const LED = (props: LEDprops): JSX.Element => { const className = classes( 'dome-xButton-led', `dome-xButton-led-${props.status || 'inactive'}`, @@ -116,7 +116,7 @@ export interface MeterProps { optimum?: number | 'LOW' | 'MEDIUM' | 'HIGH'; /** default is undefined */ } -export const Meter = (props: MeterProps) => { +export const Meter = (props: MeterProps): JSX.Element => { const { className, style, value, optimum, ...ms } = props; const min = props.min ?? 0.0; const max = props.max ?? 1.0; diff --git a/ivette/src/dome/renderer/controls/icons.tsx b/ivette/src/dome/renderer/controls/icons.tsx index aa336cb6d4cefbd9a2f023910fa5c0899919cab0..1c057d397d76d3a7883a3535d7181a2505126fac 100644 --- a/ivette/src/dome/renderer/controls/icons.tsx +++ b/ivette/src/dome/renderer/controls/icons.tsx @@ -109,7 +109,7 @@ export interface IconProps extends SVGprops { Icon Component. Consult the [Icon Gallery](../guides/icons.md.html) for default icons. */ -export function Icon(props: IconProps) { +export function Icon(props: IconProps): JSX.Element { const { id, title, onClick, fill, size, className = '', offset, style, @@ -150,7 +150,7 @@ export interface BadgeProps { a label, or the corresponding named icon. Consult the [Icon Gallery](gallery-icons.html) for default icons. */ -export function Badge(props: BadgeProps) { +export function Badge(props: BadgeProps): JSX.Element { const { value, title, onClick } = props; let content; if (typeof value === 'string' && Icons[value]) { @@ -190,7 +190,7 @@ export interface CustomIcon { /** Register a new custom icon. */ -export function register(icon: CustomIcon) { +export function register(icon: CustomIcon): void { const { id, ...jsicon } = icon; Icons[id] = jsicon; } @@ -199,7 +199,7 @@ export function register(icon: CustomIcon) { Iterate over icons gallery. See [[register]] to add custom icons to the gallery. */ -export function forEach(fn: (ico: CustomIcon) => void) { +export function forEach(fn: (ico: CustomIcon) => void): void { const ids = Object.keys(Icons); ids.forEach((id) => { const jsicon = Icons[id]; diff --git a/ivette/src/dome/renderer/controls/labels.tsx b/ivette/src/dome/renderer/controls/labels.tsx index 630d9bfd0a075d4a76e9704a5262ce88c9fc5322..192232a8df6b7712131b694fa556028437337045 100644 --- a/ivette/src/dome/renderer/controls/labels.tsx +++ b/ivette/src/dome/renderer/controls/labels.tsx @@ -29,7 +29,7 @@ @module dome/controls/labels */ -import React from 'react'; +import React, { LegacyRef } from 'react'; import { classes } from 'dome/misc/utils'; import { Icon } from './icons'; import './style.css'; @@ -63,7 +63,11 @@ export interface LabelProps { } const makeLabel = (className: string) => - function Label(props: LabelProps, ref: any) { + function Label + ( + props: LabelProps, + ref: LegacyRef<HTMLLabelElement> | undefined + ): JSX.Element { const { display = true } = props; const allClasses = classes( className, diff --git a/ivette/src/dome/renderer/data/compare.ts b/ivette/src/dome/renderer/data/compare.ts index 5254f927550462a91c12d75b8b62874f67756b57..df7bf9a881ec1e4bf7398681af71a5879f27659c 100644 --- a/ivette/src/dome/renderer/data/compare.ts +++ b/ivette/src/dome/renderer/data/compare.ts @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + // -------------------------------------------------------------------------- // --- Comparison Utilities // -------------------------------------------------------------------------- @@ -67,7 +69,7 @@ export function isBigNum(x: any): x is BigNum { } /** @internal */ -function primitive(x: any, y: any) { +function primitive(x: any, y: any): number { if (x < y) return -1; if (x > y) return 1; return 0; @@ -96,7 +98,7 @@ export const bignum: Order<BigNum> = primitive; /** Primitive comparison for number (NaN included). */ -export function number(x: number, y: number) { +export function number(x: number, y: number): number { const nx = Number.isNaN(x); const ny = Number.isNaN(y); if (nx && ny) return 0; @@ -111,7 +113,7 @@ export function number(x: number, y: number) { Alphabetic comparison for strings. Handles case differently than `byString` comparison. */ -export function alpha(x: string, y: string) { +export function alpha(x: string, y: string): number { const cmp = primitive(x.toLowerCase(), y.toLowerCase()); return cmp !== 0 ? cmp : primitive(x, y); } diff --git a/ivette/src/dome/renderer/data/json.ts b/ivette/src/dome/renderer/data/json.ts index 8983e09488c3c3984aa68a06be5ac59186027ef7..19426eb793b77603ff5cf2be17207716a435d65f 100644 --- a/ivette/src/dome/renderer/data/json.ts +++ b/ivette/src/dome/renderer/data/json.ts @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + // -------------------------------------------------------------------------- // --- JSON Utilities // -------------------------------------------------------------------------- @@ -62,14 +64,14 @@ export function parse(text: string, noError = false): json { /** Export JSON (or any data) as a compact string. */ -export function stringify(js: any) { +export function stringify(js: any): string { return JSON.stringify(js, undefined, 0); } /** Export JSON (or any data) as a string with indentation. */ -export function pretty(js: any) { +export function pretty(js: any): string { return JSON.stringify(js, undefined, 2); } diff --git a/ivette/src/dome/renderer/data/settings.ts b/ivette/src/dome/renderer/data/settings.ts index d63c4d9cd6056403b921315f1dcab89ebe0ee25c..9ea1a88fbe449995cf63719ba8504f6aabbdf3fe 100644 --- a/ivette/src/dome/renderer/data/settings.ts +++ b/ivette/src/dome/renderer/data/settings.ts @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- States // -------------------------------------------------------------------------- diff --git a/ivette/src/dome/renderer/data/states.ts b/ivette/src/dome/renderer/data/states.ts index beb1eb269dd08a21d6da4787513f2a0ec7919d89..44047c7f86da009d392105d0f856906efa684d7c 100644 --- a/ivette/src/dome/renderer/data/states.ts +++ b/ivette/src/dome/renderer/data/states.ts @@ -102,10 +102,10 @@ export class GlobalState<A> { } /** Current state value. */ - getValue() { return this.value; } + getValue(): A { return this.value; } /** Notify callbacks on change, using _deep_ structural comparison. */ - setValue(value: A) { + setValue(value: A): void { if (!isEqual(value, this.value)) { this.value = value; this.emitter.emit(UPDATE, value); @@ -113,12 +113,12 @@ export class GlobalState<A> { } /** Callback Emitter. */ - on(callback: (value: A) => void) { + on(callback: (value: A) => void): void { this.emitter.on(UPDATE, callback); } /** Callback Emitter. */ - off(callback: (value: A) => void) { + off(callback: (value: A) => void): void { this.emitter.off(UPDATE, callback); } diff --git a/ivette/src/dome/renderer/dialogs.tsx b/ivette/src/dome/renderer/dialogs.tsx index c117832f27061f605a8e595c6b99d1692b2345b9..80e37afdcd38742cea3af72e7e582c27702d56fe 100644 --- a/ivette/src/dome/renderer/dialogs.tsx +++ b/ivette/src/dome/renderer/dialogs.tsx @@ -44,7 +44,7 @@ const defaultItems: DialogButton<boolean>[] = [ { value: true, label: 'Ok' }, ]; -const valueLabel = (v: any) => { +const valueLabel = (v: unknown): string => { switch (v) { case undefined: return 'Cancel'; case true: return 'Ok'; @@ -53,15 +53,15 @@ const valueLabel = (v: any) => { } }; -const itemLabel = ({ value, label }: DialogButton<any>) => ( +const itemLabel = ({ value, label }: DialogButton<unknown>): string => ( (label || valueLabel(value)) ); -const isDefault = ({ value, label }: DialogButton<any>) => ( +const isDefault = ({ value, label }: DialogButton<unknown>): boolean => ( (value === true || label === 'Ok' || label === 'Yes') ); -const isCancel = ({ value, label }: DialogButton<any>) => ( +const isCancel = ({ value, label }: DialogButton<unknown>): boolean => ( (!value || label === 'Cancel' || label === 'No') ); @@ -142,7 +142,8 @@ export async function showMessageBox<A>( // -------------------------------------------------------------------------- const defaultPath = - (path: string) => (filepath.extname(path) ? filepath.dirname(path) : path); + (path: string): string => + (filepath.extname(path) ? filepath.dirname(path) : path); export interface FileFilter { /** Filter name. */ diff --git a/ivette/src/dome/renderer/dome.tsx b/ivette/src/dome/renderer/dome.tsx index 4caa280dbd62740277421d9460d89ef636f62786..70283040fee5503b099b291bf13891481b0eff8a 100644 --- a/ivette/src/dome/renderer/dome.tsx +++ b/ivette/src/dome/renderer/dome.tsx @@ -20,6 +20,9 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + /** Dome Application (Renderer Process) diff --git a/ivette/src/dome/renderer/errors.tsx b/ivette/src/dome/renderer/errors.tsx index a955124cf33a9dd76ad9d008f1b1e4b27c765555..998736ef0cecc61d2314ade2cc5afd9aea8f2eca 100644 --- a/ivette/src/dome/renderer/errors.tsx +++ b/ivette/src/dome/renderer/errors.tsx @@ -42,7 +42,7 @@ import { Button } from 'dome/controls/buttons'; @param reload - callback for re-rendering the faulty component */ export interface ErrorRenderer { - (error: any, info: any, reload: () => void): JSX.Element; + (error: unknown, info: unknown, reload: () => void): JSX.Element; } export interface CatchProps { @@ -53,8 +53,8 @@ export interface CatchProps { } interface CatchState { - error?: any; - info?: any; + error?: unknown; + info?: unknown; } /** @@ -69,20 +69,20 @@ export class Catch extends React.Component<CatchProps, CatchState, unknown> { this.reload = this.reload.bind(this); } - componentDidCatch(error: any, info: any) { + componentDidCatch(error: unknown, info: unknown): void { this.setState({ error, info }); } - logerr() { + logerr(): void { const { error, info } = this.state; console.error('[dome] Catched error:', error, info); } - reload() { + reload(): void { this.setState({ error: undefined, info: undefined }); } - render() { + render(): JSX.Element { const { error, info } = this.state; if (error) { const { onError, label = 'Error' } = this.props; @@ -93,7 +93,7 @@ export class Catch extends React.Component<CatchProps, CatchState, unknown> { <Button icon="WARNING" kind="warning" - title={error} + title={typeof(error) === 'string' ? error : undefined} onClick={this.logerr} /> <Button icon="RELOAD" onClick={this.reload} /> @@ -101,7 +101,7 @@ export class Catch extends React.Component<CatchProps, CatchState, unknown> { </div> ); } - return this.props.children || null; + return (<>{this.props.children}</>); } } diff --git a/ivette/src/dome/renderer/frame/sidebars.tsx b/ivette/src/dome/renderer/frame/sidebars.tsx index ab00240d36aeedf21f565b28fd781f1cb442fe2f..adb2f89d41dbff255a31892c462ee90ae15247dd 100644 --- a/ivette/src/dome/renderer/frame/sidebars.tsx +++ b/ivette/src/dome/renderer/frame/sidebars.tsx @@ -50,7 +50,7 @@ export interface SideBarProps { /** Container for sidebar items. */ -export function SideBar(props: SideBarProps) { +export function SideBar(props: SideBarProps): JSX.Element { const className = classes( 'dome-xSideBar', 'dome-color-frame', @@ -91,7 +91,12 @@ const makeBadge = (elt: Badges): React.ReactNode => { // --- SideBar Section Hide/Show Button // -------------------------------------------------------------------------- -const HideShow = (props: { onClick: () => void; visible: boolean }) => ( +interface HideShowProps { + onClick: () => void; + visible: boolean; +} + +const HideShow = (props: HideShowProps): JSX.Element => ( <label className="dome-xSideBarSection-hideshow dome-text-label" onClick={props.onClick} @@ -137,7 +142,7 @@ export interface SectionProps { Sections with no items are not displayed. */ -export function Section(props: SectionProps) { +export function Section(props: SectionProps): JSX.Element | null { const [state, flipState] = useFlipSettings( props.settings, @@ -202,7 +207,7 @@ export interface ItemProps { } /** Sidebar Items. */ -export function Item(props: ItemProps) { +export function Item(props: ItemProps): JSX.Element { const { selected = false, disabled = false, enabled = true } = props; const isDisabled = disabled || !enabled; const ref = React.useRef<HTMLDivElement>(null); diff --git a/ivette/src/dome/renderer/frame/tabs.tsx b/ivette/src/dome/renderer/frame/tabs.tsx index 9200de9dce20db3fe2739878f853c02c9d2316ef..f8533be7ae6237b79a3e01a9c8e4a2f3dda40ec2 100644 --- a/ivette/src/dome/renderer/frame/tabs.tsx +++ b/ivette/src/dome/renderer/frame/tabs.tsx @@ -43,7 +43,7 @@ export interface TabsBarProps { } /** Container for Tabs. */ -export function TabsBar(props: TabsBarProps) { +export function TabsBar(props: TabsBarProps): JSX.Element { return ( <div className="dome-xTabsBar dome-color-frame"> {props.children} @@ -73,7 +73,7 @@ export interface TabProps<A> { } /** Tab Selector. */ -export function Tab<A>(props: TabProps<A>) { +export function Tab<A>(props: TabProps<A>): JSX.Element { const { value, selection, onSelection, onClose } = props; const selected = value === selection; // --- Tab Rendering diff --git a/ivette/src/dome/renderer/frame/toolbars.tsx b/ivette/src/dome/renderer/frame/toolbars.tsx index 25c1c067ebd2919c46fd200bbb1ec0e3e5b46c45..02ef1024d2ddf81762fd65da6aea73f72c25fdc6 100644 --- a/ivette/src/dome/renderer/frame/toolbars.tsx +++ b/ivette/src/dome/renderer/frame/toolbars.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- ToolBars // -------------------------------------------------------------------------- @@ -232,7 +234,7 @@ export function Select(props: SelectionProps<string>) { const DEBOUNCED_SEARCH = 200; -const scrollToRef = (r: undefined | HTMLLabelElement) => { +const scrollToRef = (r: null | HTMLLabelElement) => { if (r) r.scrollIntoView({ block: 'nearest' }); }; diff --git a/ivette/src/dome/renderer/layout/boxes.tsx b/ivette/src/dome/renderer/layout/boxes.tsx index 5d8d33fbb92f829e2acfb733cc4fc5a7471c1356..f19217400d52a1dae49f71a63067ab9c2c1735e6 100644 --- a/ivette/src/dome/renderer/layout/boxes.tsx +++ b/ivette/src/dome/renderer/layout/boxes.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Box Layout // -------------------------------------------------------------------------- diff --git a/ivette/src/dome/renderer/layout/dispatch.tsx b/ivette/src/dome/renderer/layout/dispatch.tsx index b169b3570041fc8d8f1d1e46e380710d247a6a9e..6383035e483a05f3e481c99f8283bfed7d977a1c 100644 --- a/ivette/src/dome/renderer/layout/dispatch.tsx +++ b/ivette/src/dome/renderer/layout/dispatch.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Dispatch Layout // -------------------------------------------------------------------------- @@ -54,7 +56,7 @@ class ITEM { this.event = new Event(`dome-dispatch-${id}`); } - update(content: React.ReactNode) { + update(content: React.ReactNode): void { this.content = content; if (this.rendered) { this.rendered = false; diff --git a/ivette/src/dome/renderer/layout/forms.tsx b/ivette/src/dome/renderer/layout/forms.tsx index 1bd3c06935a48214c072342350ffdf49b80e3992..089f9e02712ceb8b634eafed6408e693343610ef 100644 --- a/ivette/src/dome/renderer/layout/forms.tsx +++ b/ivette/src/dome/renderer/layout/forms.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + /* --------------------------------------------------------------------------*/ /* --- Form Fields ---*/ /* --------------------------------------------------------------------------*/ diff --git a/ivette/src/dome/renderer/layout/splitters.tsx b/ivette/src/dome/renderer/layout/splitters.tsx index 95c90d24bb7e7ce87199fa8111dc67496799d2c8..1574370a7d68a98ffde625499219e1530532db34 100644 --- a/ivette/src/dome/renderer/layout/splitters.tsx +++ b/ivette/src/dome/renderer/layout/splitters.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Splitters // -------------------------------------------------------------------------- diff --git a/ivette/src/dome/renderer/table/arrays.ts b/ivette/src/dome/renderer/table/arrays.ts index 5dc126e4f907fc72493ad5d6f9403f6f71f2c7c0..e46de5387e2b29e343c4137e51ff5ffba73ff167 100644 --- a/ivette/src/dome/renderer/table/arrays.ts +++ b/ivette/src/dome/renderer/table/arrays.ts @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Array Models // -------------------------------------------------------------------------- @@ -266,9 +268,9 @@ export class ArrayModel<Key, Row> } } - canSortBy(column: string) { - const columns = this.columns as any; - return columns[column] !== undefined; + canSortBy(column: string): boolean { + const columns = this.columns; + return !!columns && columns[column] !== undefined; } getSorting(): SortingInfo | undefined { @@ -460,7 +462,7 @@ export class CompactModel<Key, Row> extends ArrayModel<Key, Row> { getkey: (d: Row) => Key; /** @param key - the key property of `Row` holding an entry identifier. */ - constructor(getkey: any) { + constructor(getkey: (d: Row) => Key) { super(); this.getkey = getkey; } diff --git a/ivette/src/dome/renderer/table/models.ts b/ivette/src/dome/renderer/table/models.ts index 297aef8ce54bded0bc79726be5b8cffa3aa94408..9bc4f6feb5fd787979ebc3ce91c5b36e395ddae1 100644 --- a/ivette/src/dome/renderer/table/models.ts +++ b/ivette/src/dome/renderer/table/models.ts @@ -102,7 +102,7 @@ export interface Filtering<Key, Row> { export type Collection<A> = undefined | null | A | Collection<A>[]; /** Iterator over collection. */ -export function forEach<A>(data: Collection<A>, fn: (elt: A) => void) { +export function forEach<A>(data: Collection<A>, fn: (elt: A) => void): void { if (Array.isArray(data)) data.forEach((e) => forEach(e, fn)); else if (data !== undefined && data !== null) fn(data); } @@ -201,7 +201,7 @@ export abstract class Model<Key, Row> { delegates to [[updateIndex]]. All views that might be rendering the specified item will be updated. */ - update(key: Key) { + update(key: Key): void { const k = this.getIndexOf(key); if (k !== undefined && 0 <= k) this.updateIndex(k); } @@ -211,7 +211,7 @@ export abstract class Model<Key, Row> { @param first - the first updated item index @param last - the last updated item index (defaults to `first`) */ - updateIndex(first: number, last = first) { + updateIndex(first: number, last = first): void { if (first <= last) { this.clients.forEach(({ lower, upper, update }) => { if (update && first <= upper && lower <= last) update(); @@ -223,7 +223,7 @@ export abstract class Model<Key, Row> { Re-render all views. Bound to this. */ - reload() { + reload(): void { this.clients.forEach(({ reload }) => reload && reload()); } @@ -271,7 +271,7 @@ export abstract class Model<Key, Row> { @return a number that can be used to memoize other effects */ -export function useModel(model: Model<any, any>, sync = true): number { +export function useModel<K, R>(model: Model<K, R>, sync = true): number { const [age, setAge] = React.useState(0); React.useEffect(() => { if (sync) { diff --git a/ivette/src/dome/renderer/table/views.tsx b/ivette/src/dome/renderer/table/views.tsx index 54cae79cb42374778e1ddfbae5cfb1a83545c42c..5f760dbb0ef4efa5950ad66c7dc29000c3ce9f38 100644 --- a/ivette/src/dome/renderer/table/views.tsx +++ b/ivette/src/dome/renderer/table/views.tsx @@ -20,6 +20,9 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + // -------------------------------------------------------------------------- // --- Tables // -------------------------------------------------------------------------- diff --git a/ivette/src/dome/renderer/text/buffers.ts b/ivette/src/dome/renderer/text/buffers.ts index 50a6ad1310797c6245412ab99154be2f56354c21..e2d7eecc62d2fd47db3dedf37f36fd4c83182408 100644 --- a/ivette/src/dome/renderer/text/buffers.ts +++ b/ivette/src/dome/renderer/text/buffers.ts @@ -20,6 +20,9 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + // -------------------------------------------------------------------------- // --- Text Documents // -------------------------------------------------------------------------- diff --git a/ivette/src/dome/renderer/text/editors.tsx b/ivette/src/dome/renderer/text/editors.tsx index cb9036dc52f980dcf660d3c4ee9db864a12b0722..ad8a0153aaca953a19ea7d03cdfe795c71ccdfcc 100644 --- a/ivette/src/dome/renderer/text/editors.tsx +++ b/ivette/src/dome/renderer/text/editors.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Text Documents // -------------------------------------------------------------------------- diff --git a/ivette/src/dome/renderer/text/pages.tsx b/ivette/src/dome/renderer/text/pages.tsx index f7c3c947b0520e9c68e0b7fefe065de4902e6d3c..d43486e42c63cc8d5ee01041d27961c03f629aa7 100644 --- a/ivette/src/dome/renderer/text/pages.tsx +++ b/ivette/src/dome/renderer/text/pages.tsx @@ -68,7 +68,7 @@ export interface TextProps { The page has insets and shadows and fills the entire available area. Large content is crolled inside in both directions. */ -export const Page = (props: TextProps) => ( +export const Page = (props: TextProps): JSX.Element => ( <div className="dome-xPages-page"> <div className={classes('dome-xPages-sheet dome-pages', props.className)} @@ -88,7 +88,7 @@ export const Page = (props: TextProps) => ( The area has small padding and no margin, and does not scroll its content. */ -export const Note = (props: TextProps) => ( +export const Note = (props: TextProps): JSX.Element => ( <div className={classes('dome-xPages-note', 'dome-pages', props.className)} style={props.style} diff --git a/ivette/src/frama-c/.eslintrc.json b/ivette/src/frama-c/.eslintrc.json deleted file mode 100644 index fb24a7a0c7575b4542d30ec947c809f3bc8332a0..0000000000000000000000000000000000000000 --- a/ivette/src/frama-c/.eslintrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "rules": { - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-function-return-type": "off" - } -} \ No newline at end of file diff --git a/ivette/src/frama-c/client_socket.ts b/ivette/src/frama-c/client_socket.ts index b057f96598ff2ef59134e6b231dee5a7c52bf17e..bccc07a2665cbd471ceca32c6aa254734d5c6311 100644 --- a/ivette/src/frama-c/client_socket.ts +++ b/ivette/src/frama-c/client_socket.ts @@ -134,7 +134,7 @@ class SocketClient extends Client { // --- Low-Level Management // -------------------------------------------------------------------------- - _flush() { + _flush(): void { if (this.running) { this.queue.forEach((cmd) => { this._send(Buffer.from(JSON.stringify(cmd), 'utf8')); @@ -143,7 +143,7 @@ class SocketClient extends Client { } } - _send(data: Buffer) { + _send(data: Buffer): void { const s = this.socket; if (s) { const len = data.length; @@ -173,7 +173,7 @@ class SocketClient extends Client { return msg.slice(phex, offset).toString('utf8'); } - _receive(chunk: Buffer) { + _receive(chunk: Buffer): void { this.buffer = Buffer.concat([this.buffer, chunk]); while (true) { const n0 = this.buffer.length; diff --git a/ivette/src/frama-c/client_zmq.ts b/ivette/src/frama-c/client_zmq.ts index 5834e0c4bdfda3f78b8b18063172db44f24a084a..ece84a9d5e61813b98e5a4d8830e0a427ae5bf1a 100644 --- a/ivette/src/frama-c/client_zmq.ts +++ b/ivette/src/frama-c/client_zmq.ts @@ -114,7 +114,7 @@ class ZmqClient extends Client { // --- Low-Level Management // -------------------------------------------------------------------------- - _flush() { + _flush(): void { const socket = this.zmqSocket; if (socket) { const cmds = this.queue; @@ -133,7 +133,7 @@ class ZmqClient extends Client { } } - _receive(resp: string[]) { + _receive(resp: string[]): void { try { this._decode(resp); } catch (err) { @@ -145,8 +145,8 @@ class ZmqClient extends Client { } /* eslint-disable @typescript-eslint/indent */ - _decode(resp: string[]) { - const shift = () => resp.shift() ?? ''; + _decode(resp: string[]): void { + const shift = (): string => resp.shift() ?? ''; while (resp.length) { const cmd = shift(); switch (cmd) { diff --git a/ivette/src/frama-c/kernel/ASTinfo.tsx b/ivette/src/frama-c/kernel/ASTinfo.tsx index 4601eae5daed95d4cf9cb7a62960fa98f0f3d4a8..ab3f97412b49ec2d17d6a60337a608c21a208d27 100644 --- a/ivette/src/frama-c/kernel/ASTinfo.tsx +++ b/ivette/src/frama-c/kernel/ASTinfo.tsx @@ -37,7 +37,7 @@ import { getInfo } from 'frama-c/api/kernel/ast'; // --- Information Panel // -------------------------------------------------------------------------- -export default function ASTinfo() { +export default function ASTinfo(): JSX.Element { const buffer = React.useMemo(() => new RichTextBuffer(), []); const [selection, updateSelection] = States.useSelection(); @@ -52,7 +52,7 @@ export default function ASTinfo() { }, [buffer, data]); // Callbacks - function onTextSelection(id: string) { + function onTextSelection(id: string): void { // For now, the only markers are functions. const location = { fct: id }; updateSelection({ location }); diff --git a/ivette/src/frama-c/kernel/ASTview.tsx b/ivette/src/frama-c/kernel/ASTview.tsx index a925d593f89e13bb061e2fa50be05b93d9c5f879..c79c3a487efdc0a4492e3f3468a2196c5cb7f25a 100644 --- a/ivette/src/frama-c/kernel/ASTview.tsx +++ b/ivette/src/frama-c/kernel/ASTview.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- AST Source Code // -------------------------------------------------------------------------- diff --git a/ivette/src/frama-c/kernel/Globals.tsx b/ivette/src/frama-c/kernel/Globals.tsx index 6c9714d287b8ab459218a8f2dc7d50b39eb90087..b0866f019fca18c4784ecba8e19c4d4b80036fdf 100644 --- a/ivette/src/frama-c/kernel/Globals.tsx +++ b/ivette/src/frama-c/kernel/Globals.tsx @@ -68,7 +68,7 @@ interface FctItemProps { onSelection: (name: string) => void; } -function FctItem(props: FctItemProps) { +function FctItem(props: FctItemProps): JSX.Element { const { name, signature, main, stdlib, builtin, defined } = props.fct; const className = classes( main && 'globals-main', @@ -95,7 +95,7 @@ function FctItem(props: FctItemProps) { // --- Globals Section(s) // -------------------------------------------------------------------------- -export default function Globals() { +export default function Globals(): JSX.Element { // Hooks const [selection, updateSelection] = States.useSelection(); @@ -117,7 +117,7 @@ export default function Globals() { const multipleSelectionActive = multipleSelection?.allSelections.length > 0; const evaComputed = States.useSyncValue(computationState) === 'computed'; - function isSelected(fct: functionsData) { + function isSelected(fct: functionsData): boolean { return multipleSelection?.allSelections.some( (l) => fct.name === l?.fct, ); @@ -126,21 +126,21 @@ export default function Globals() { // Currently selected function. const current: undefined | string = selection?.current?.fct; - function showFunction(fct: functionsData) { + function showFunction(fct: functionsData): boolean { const visible = (stdlib || !fct.stdlib) && (builtin || !fct.builtin) && (undef || fct.defined) && (!evaOnly || !evaComputed || (fct.eva_analyzed === true)) && (!selected || !multipleSelectionActive || isSelected(fct)); - return visible || (current && fct.name === current); + return visible || (!!current && fct.name === current); } - function onSelection(name: string) { + function onSelection(name: string): void { updateSelection({ location: { fct: name } }); } - async function onContextMenu() { + async function onContextMenu(): Promise<void> { const items: Dome.PopupMenuItem[] = [ { label: 'Show Frama-C builtins', diff --git a/ivette/src/frama-c/kernel/History.tsx b/ivette/src/frama-c/kernel/History.tsx index 5acd842a066c8b82aae272ce66c98699dd20f31c..e7a3b91929ff4308a97cb880598bb0a22783e98b 100644 --- a/ivette/src/frama-c/kernel/History.tsx +++ b/ivette/src/frama-c/kernel/History.tsx @@ -28,11 +28,11 @@ import React from 'react'; import * as Toolbar from 'dome/frame/toolbars'; import * as States from 'frama-c/states'; -export default function History() { +export default function History(): JSX.Element { const [selection, updateSelection] = States.useSelection(); - const doPrevSelect = () => { updateSelection('HISTORY_PREV'); }; - const doNextSelect = () => { updateSelection('HISTORY_NEXT'); }; + const doPrevSelect = () => void updateSelection('HISTORY_PREV'); + const doNextSelect = () => void updateSelection('HISTORY_NEXT'); return ( <Toolbar.ButtonGroup> diff --git a/ivette/src/frama-c/kernel/Locations.tsx b/ivette/src/frama-c/kernel/Locations.tsx index cbf53ed1fe9b1d7acd0618b216c9331a16a5c48f..a318d834a6d6a6d3f03851e61e865fd11c67cf27 100644 --- a/ivette/src/frama-c/kernel/Locations.tsx +++ b/ivette/src/frama-c/kernel/Locations.tsx @@ -42,7 +42,7 @@ import { markerInfo } from 'frama-c/api/kernel/ast'; type LocationId = States.Location & { id: number }; -export default function LocationsTable() { +export default function LocationsTable(): JSX.Element { // Hooks const [selection, updateSelection] = States.useSelection(); @@ -79,7 +79,7 @@ export default function LocationsTable() { [updateSelection], ); - const reload = () => { + const reload = (): void => { const location = multipleSelections.allSelections[multipleSelections.index]; updateSelection({ location }); }; diff --git a/ivette/src/frama-c/kernel/Messages.tsx b/ivette/src/frama-c/kernel/Messages.tsx index 53e32f5232ab526fec99d73535a71c8f61114520..3cd7892f5855defb805a7dd7e5d8445a885045e0 100644 --- a/ivette/src/frama-c/kernel/Messages.tsx +++ b/ivette/src/frama-c/kernel/Messages.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + import * as React from 'react'; import * as Dome from 'dome'; import { TitleBar } from 'ivette'; diff --git a/ivette/src/frama-c/kernel/Properties.tsx b/ivette/src/frama-c/kernel/Properties.tsx index 5163266c43c8dca3cb1946e611f0315632848329..ce617cf16d6b3c55fdd4bdc6f692582eae178609 100644 --- a/ivette/src/frama-c/kernel/Properties.tsx +++ b/ivette/src/frama-c/kernel/Properties.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Properties // -------------------------------------------------------------------------- @@ -224,9 +226,9 @@ function filterEva(p: Property) { function filterProperty(p: Property) { return filterStatus(p.status) - && filterKind(p.kind) - && filterAlarm(p.alarm) - && filterEva(p); + && filterKind(p.kind) + && filterAlarm(p.alarm) + && filterEva(p); } // -------------------------------------------------------------------------- @@ -258,7 +260,7 @@ const renderFile: Renderer<Ast.source> = const renderPriority: Renderer<boolean> = (prio: boolean) => (prio ? <Icon id="ATTENTION" /> : null); -const renderTaint: Renderer<any> = +const renderTaint: Renderer<States.Tag> = (taint: States.Tag) => { let id = null; let color = 'black'; @@ -335,7 +337,8 @@ const byColumn: Arrays.ByColumns<Property> = { file: Compare.byFields<Property>({ source: byFile }), }; -class PropertyModel extends Arrays.CompactModel<Json.key<'#status'>, Property> { +class PropertyModel + extends Arrays.CompactModel<Json.key<'#property'>, Property> { private filterFun?: string; diff --git a/ivette/src/frama-c/kernel/SourceCode.tsx b/ivette/src/frama-c/kernel/SourceCode.tsx index a6100ca4aa4daf64774c17888f7e710fd9ddf319..578415aeda9f454b0a45c861ff071cbdb22f8597 100644 --- a/ivette/src/frama-c/kernel/SourceCode.tsx +++ b/ivette/src/frama-c/kernel/SourceCode.tsx @@ -60,7 +60,7 @@ const D = new Dome.Debug('Source Code'); // The SourceCode component, producing the GUI part showing the source code // corresponding to the selected function. -export default function SourceCode() { +export default function SourceCode(): JSX.Element { // Hooks const [buffer] = React.useState(() => new RichTextBuffer()); @@ -91,7 +91,7 @@ export default function SourceCode() { // Updating the buffer content. const text = React.useMemo(async () => { - const onError = () => { + const onError = (): string => { if (file) D.error(`Fail to load source code file ${file}`); return ''; @@ -150,7 +150,7 @@ export default function SourceCode() { }, [buffer, selectCallback]); const [command] = Settings.useGlobalSettings(Preferences.EditorCommand); - async function launchEditor(_?: editor, pos?: position) { + async function launchEditor(_?: editor, pos?: position): Promise<void> { if (file !== '') { const selectedLine = pos ? (pos.line + 1).toString() : '1'; const selectedChar = pos ? (pos.ch + 1).toString() : '1'; @@ -169,7 +169,7 @@ export default function SourceCode() { } } - async function contextMenu(editor?: editor, pos?: position) { + async function contextMenu(editor?: editor, pos?: position): Promise<void> { if (file !== '') { const items = [ { diff --git a/ivette/src/frama-c/kernel/Status.tsx b/ivette/src/frama-c/kernel/Status.tsx index c65da88025a299d2f44aaf2d92c3574264854f30..8b0b2ce8477fc8388e071b4a8d52e6a5bb31b782 100644 --- a/ivette/src/frama-c/kernel/Status.tsx +++ b/ivette/src/frama-c/kernel/Status.tsx @@ -46,11 +46,11 @@ const emptyMessage: MessageProps = { text: '', kind: 'none' }; const GlobalMessage = new GlobalState(emptyMessage); -export function setMessage(message: MessageProps) { +export function setMessage(message: MessageProps): void { GlobalMessage.setValue(message); } -export default function Message() { +export default function Message(): JSX.Element { const [message] = useGlobalState(GlobalMessage); return ( <> diff --git a/ivette/src/frama-c/menu.ts b/ivette/src/frama-c/menu.ts index 66c5e17a0707a993aa0296dbd86fa95a422f749f..1fd0dedadfb6f48abe50ea09989da23fc80524bc 100644 --- a/ivette/src/frama-c/menu.ts +++ b/ivette/src/frama-c/menu.ts @@ -133,7 +133,7 @@ async function saveSession(): Promise<void> { return; } -export function init() { +export function init(): void { Dome.addMenuItem({ menu: 'File', label: 'Set source files…', diff --git a/ivette/src/frama-c/plugins/dive/index.tsx b/ivette/src/frama-c/plugins/dive/index.tsx index 9adfa9f4f0122a5b8659ea9781863c48b0ddcc91..37bbd9b64e6607e3a6c967ae46e2e65deac49639 100644 --- a/ivette/src/frama-c/plugins/dive/index.tsx +++ b/ivette/src/frama-c/plugins/dive/index.tsx @@ -68,7 +68,7 @@ function buildCxtMenu( commands: Cxtcommand[], content?: JSX.Element, action?: () => void, -) { +): void { commands.push({ content: content ? renderToString(content) : '', select: action || (() => { /* Do nothing */ }), @@ -78,7 +78,7 @@ function buildCxtMenu( /* double click events for Cytoscape */ -function enableDoubleClickEvents(cy: Cytoscape.Core, delay = 350) { +function enableDoubleClickEvents(cy: Cytoscape.Core, delay = 350): void { let last: Cytoscape.EventObject | undefined; cy.on('click', (e) => { if (last && last.target === e.target && @@ -145,7 +145,7 @@ class Dive { this.refresh(); } - onCxtMenu(node: Cytoscape.NodeSingular) { + onCxtMenu(node: Cytoscape.NodeSingular): Cxtcommand[] { const data = node.data(); const commands = [] as Cxtcommand[]; buildCxtMenu(commands, @@ -167,7 +167,7 @@ class Dive { return commands; } - remove(node: Cytoscape.NodeSingular) { + remove(node: Cytoscape.NodeSingular): void { const parent = node.parent(); node.remove(); this.cy.$id(`${node.id()}-more`).remove(); @@ -394,8 +394,8 @@ class Dive { async exec<In>( request: Server.ExecRequest<In, API.diffData | null>, - param: In, - ) { + param: In): Promise<Cytoscape.NodeSingular | undefined> + { try { if (Server.isRunning()) { await this.setMode(); @@ -408,10 +408,10 @@ class Dive { console.error(err); } - return null; + return undefined; } - async refresh() { + async refresh(): Promise<void> { try { if (Server.isRunning()) { const data = await Server.send(API.graph, {}); @@ -455,13 +455,13 @@ class Dive { this.exec(API.clear, null); } - async add(marker: string) { + async add(marker: string): Promise<void> { const node = await this.exec(API.add, marker); if (node) this.updateNodeSelection(node); } - async explore(node: Cytoscape.NodeSingular) { + async explore(node: Cytoscape.NodeSingular): Promise<void> { const id = parseInt(node.id(), 10); if (id) await this.exec(API.explore, id); @@ -479,7 +479,7 @@ class Dive { this.exec(API.hide, id); } - async clickNode(node: Cytoscape.NodeSingular) { + async clickNode(node: Cytoscape.NodeSingular): Promise<void> { this.updateNodeSelection(node); await this.explore(node); @@ -493,11 +493,13 @@ class Dive { node.unselectify(); } - doubleClickNode(node: Cytoscape.NodeSingular) { + doubleClickNode(node: Cytoscape.NodeSingular): void { this.cy.animate({ fit: { eles: node, padding: 10 } }); } - selectLocation(location: States.Location | undefined, doExplore: boolean) { + selectLocation( + location: States.Location | undefined, + doExplore: boolean): void { if (!location) { // Reset whole graph if no location is selected. this.clear(); @@ -515,7 +517,7 @@ class Dive { } updateNodeSelection(node: Cytoscape.NodeSingular): void { - const hasOrigin = (ele: Cytoscape.NodeSingular) => ( + const hasOrigin = (ele: Cytoscape.NodeSingular): boolean => ( _.some(ele.data().origins, this.selectedLocation) ); this.cy.$(':selected').forEach(unselect); @@ -529,7 +531,7 @@ class Dive { } } -function GraphView() { +function GraphView(): JSX.Element { // Hooks const [dive, setDive] = useState(() => new Dive()); @@ -539,7 +541,7 @@ function GraphView() { const [selectionMode, setSelectionMode] = Dome.useStringSettings('dive.selectionMode', 'follow'); - function setCy(cy: Cytoscape.Core) { + function setCy(cy: Cytoscape.Core): void { if (cy !== dive.cy) setDive(new Dive(cy)); } @@ -569,30 +571,30 @@ function GraphView() { }, [dive, lock, selection, updateSelection]); // Layout selection - const selectLayout = (layout?: string) => { + const selectLayout = (layout?: string): void => { if (layout) { dive.layout = layout; } }; const layoutsNames = ['cose-bilkent', 'dagre', 'cola', 'klay']; - const layoutItem = (id: string) => ( + const layoutItem = (id: string): Dome.PopupMenuItem => ( { id, label: id, checked: (id === dive.layout) } ); - const layoutMenu = () => { + const layoutMenu = (): void => { Dome.popupMenu(layoutsNames.map(layoutItem), selectLayout); }; // Selection mode - const selectMode = (id?: string) => id && setSelectionMode(id); + const selectMode = (id?: string) => void (id && setSelectionMode(id)); const modes = [ { id: 'follow', label: 'Follow selection' }, { id: 'add', label: 'Add selection to the graph' }, ]; const checkMode = - (item: { id: string; label: string }) => ( + (item: { id: string; label: string }): Dome.PopupMenuItem => ( { checked: item.id === selectionMode, ...item } ); - const modeMenu = () => { + const modeMenu = (): void => { Dome.popupMenu(modes.map(checkMode), selectMode); }; diff --git a/ivette/src/frama-c/plugins/eva/Coverage.tsx b/ivette/src/frama-c/plugins/eva/Coverage.tsx index e07e8b7a4298985fc098afe56d2c45a86ef41c35..4052f6e676ebfadc833d3009312660b8c506c732 100644 --- a/ivette/src/frama-c/plugins/eva/Coverage.tsx +++ b/ivette/src/frama-c/plugins/eva/Coverage.tsx @@ -32,7 +32,7 @@ import * as States from 'frama-c/states'; import * as Eva from 'frama-c/api/plugins/eva/general'; import CoverageMeter, { percent } from './CoverageMeter'; -type key = Json.key<'#fct'>; +type key = Json.key<'#fundec'>; type stats = Eva.functionStatsData; // --- Coverage Table --- diff --git a/ivette/src/frama-c/plugins/eva/CoverageMeter.tsx b/ivette/src/frama-c/plugins/eva/CoverageMeter.tsx index 7248e4c0ea0f3b2f291e0b5793cb25d634ba5022..a39cd51bc0d69f8b49cb05ed8ac3246df12d147b 100644 --- a/ivette/src/frama-c/plugins/eva/CoverageMeter.tsx +++ b/ivette/src/frama-c/plugins/eva/CoverageMeter.tsx @@ -23,17 +23,22 @@ import React from 'react'; import { Meter } from 'dome/controls/displays'; -export interface CoverageProps { +export interface Coverage { reachable: number; dead: number; } -export function percent(coverage: CoverageProps): string { +export interface CoverageProps { + coverage: Coverage; +} + + +export function percent(coverage: Coverage): string { const q = coverage.reachable / (coverage.reachable + coverage.dead); return `${(q * 100).toFixed(1)}%`; } -export default function CoverageMeter(props: { coverage: CoverageProps }) { +export default function CoverageMeter(props: CoverageProps): JSX.Element { const { reachable, dead } = props.coverage; const total = reachable + dead; diff --git a/ivette/src/frama-c/plugins/eva/cells.ts b/ivette/src/frama-c/plugins/eva/cells.ts index 3e9a9f1d72467566ddf7b56e3ec6d231f867d25a..ac8614b069d1ea262da4a156a8061c25a8e0d9b9 100644 --- a/ivette/src/frama-c/plugins/eva/cells.ts +++ b/ivette/src/frama-c/plugins/eva/cells.ts @@ -131,7 +131,7 @@ export class ValueCache { this.state = state; } - clear() { + clear(): void { this.smax = EMPTY; this.probes.clear(); this.stacks.clear(); @@ -141,17 +141,17 @@ export class ValueCache { // --- Cached Measures - getMaxSize() { return this.smax; } + getMaxSize(): Size { return this.smax; } - getProbeSize(target: Ast.marker) { + getProbeSize(target: Ast.marker): Size { return this.probes.get(target) ?? EMPTY; } - private static stackKey(fct: string, callstack: Values.callstack) { + private static stackKey(fct: string, callstack: Values.callstack): string { return `${fct}::${callstack}`; } - getStackSize(fct: string, callstack: Values.callstack) { + getStackSize(fct: string, callstack: Values.callstack): Size { const key = ValueCache.stackKey(fct, callstack); return this.stacks.get(key) ?? EMPTY; } diff --git a/ivette/src/frama-c/plugins/eva/diffed.tsx b/ivette/src/frama-c/plugins/eva/diffed.tsx index 6078e1982b9c7eb6f3fdd4af75d2ec5d157a1525..64ff15aaa425962019a5b41e03687eae0073bb6c 100644 --- a/ivette/src/frama-c/plugins/eva/diffed.tsx +++ b/ivette/src/frama-c/plugins/eva/diffed.tsx @@ -44,7 +44,7 @@ export class DiffBuffer { this.push = this.push.bind(this); } - clear() { + clear(): void { this.added = false; this.removed = false; this.value = ''; @@ -52,7 +52,7 @@ export class DiffBuffer { this.contents = []; } - push(c: Change) { + push(c: Change): void { if (!c.added && !c.removed) { this.flush(); this.value += c.value; @@ -66,7 +66,7 @@ export class DiffBuffer { } } - private flush() { + private flush(): void { const { value, added, removed } = this; if (added && removed) { if (value) { @@ -99,7 +99,7 @@ export class DiffBuffer { return React.Children.toArray(this.contents); } - getScratch() { + getScratch(): string { this.flush(); return this.scratch; } @@ -115,7 +115,7 @@ export interface Diff2Props { diff: string; } -export function Diff2(props: Diff2Props) { +export function Diff2(props: Diff2Props): JSX.Element { const { text, diff } = props; const contents = React.useMemo<React.ReactNode>(() => { if (text === diff) return text; @@ -137,7 +137,7 @@ export interface Diff3Props { diffB: string; } -export function Diff3(props: Diff3Props) { +export function Diff3(props: Diff3Props): JSX.Element { const { text, diffA, diffB } = props; const contents = React.useMemo<React.ReactNode>(() => { if (text === diffA && text === diffB) return text; @@ -161,7 +161,8 @@ export interface DiffProps { diff2?: string; } -export function Diff(props: DiffProps) { + +export function Diff(props: DiffProps): JSX.Element | null { const { text, diff, diff2 } = props; if (text === undefined) return null; diff --git a/ivette/src/frama-c/plugins/eva/index.tsx b/ivette/src/frama-c/plugins/eva/index.tsx index 387f0833ce035d2fdbc7104c2c6fe6e3ec1f902a..3f7c2c0e82e9977c158d465427d0255fe1522204 100644 --- a/ivette/src/frama-c/plugins/eva/index.tsx +++ b/ivette/src/frama-c/plugins/eva/index.tsx @@ -49,7 +49,7 @@ import './style.css'; const globalModelState = new GlobalState(new Model()); -function ValuesComponent() { +function ValuesComponent(): JSX.Element { const [model] = useGlobalState(globalModelState); model.mount(); Dome.useUpdate(model.changed, model.laidout); diff --git a/ivette/src/frama-c/plugins/eva/layout.ts b/ivette/src/frama-c/plugins/eva/layout.ts index f6f4821c3ede6fc995d016992a86e73ed0e73d60..c08227e211b4f9a41fcf2f666bd1029c10f0a276 100644 --- a/ivette/src/frama-c/plugins/eva/layout.ts +++ b/ivette/src/frama-c/plugins/eva/layout.ts @@ -125,7 +125,7 @@ export class LayoutEngine { return 0; } - private push(p: Probe) { + private push(p: Probe): void { // --- sectionning const { fct } = p; if (fct !== this.byFct) { diff --git a/ivette/src/frama-c/plugins/eva/model.ts b/ivette/src/frama-c/plugins/eva/model.ts index 9d3e66551360bf5538d896bf0ef9e2f91fe051d4..4ea851059f542c89cc5c2777c14e6cbd24ad28e6 100644 --- a/ivette/src/frama-c/plugins/eva/model.ts +++ b/ivette/src/frama-c/plugins/eva/model.ts @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Eva Values // -------------------------------------------------------------------------- diff --git a/ivette/src/frama-c/plugins/eva/probeinfos.tsx b/ivette/src/frama-c/plugins/eva/probeinfos.tsx index 905708ec8001f951e1b31c8c0b73b9e7b6754e73..414570d97a1f35e58a268c7c05510d8606003abb 100644 --- a/ivette/src/frama-c/plugins/eva/probeinfos.tsx +++ b/ivette/src/frama-c/plugins/eva/probeinfos.tsx @@ -44,7 +44,7 @@ import { Stmt } from './valueinfos'; // --- Probe Editor // -------------------------------------------------------------------------- -function ProbeEditor(props: ModelProp) { +function ProbeEditor(props: ModelProp): JSX.Element | null { const { model } = props; const probe = model.getFocused(); if (!probe || !probe.code) return null; @@ -105,7 +105,7 @@ function ProbeEditor(props: ModelProp) { // --- Probe Panel // -------------------------------------------------------------------------- -export function ProbeInfos(props: ModelProp) { +export function ProbeInfos(props: ModelProp): JSX.Element { const { model } = props; const probe = model.getFocused(); const fct = probe?.fct; diff --git a/ivette/src/frama-c/plugins/eva/probes.ts b/ivette/src/frama-c/plugins/eva/probes.ts index 38c4497ead849d53c32e9129cb18beb805ee0bb6..3ba97ec06d601822f17914dc3a3945eb97386ce1 100644 --- a/ivette/src/frama-c/plugins/eva/probes.ts +++ b/ivette/src/frama-c/plugins/eva/probes.ts @@ -42,7 +42,7 @@ const LabelSize = 12; let La = Ka; let Lk = 0; -function newLabel() { +function newLabel(): string { const a = La; const k = Lk; const lbl = String.fromCharCode(a); @@ -87,7 +87,7 @@ export class Probe { this.requestProbeInfo = this.requestProbeInfo.bind(this); } - requestProbeInfo() { + requestProbeInfo(): void { this.loading = true; this.label = '…'; Server @@ -121,17 +121,17 @@ export class Probe { // --- Internal State // -------------------------------------------------------------------------- - setPersistent() { this.updateTransient(false); } - setTransient() { this.updateTransient(true); } + setPersistent(): void { this.updateTransient(false); } + setTransient(): void { this.updateTransient(true); } - private updateTransient(tr: boolean) { + private updateTransient(tr: boolean): void { if (this.transient !== tr) { this.transient = tr; this.model.forceLayout(); } } - setZoomed(zoomed: boolean) { + setZoomed(zoomed: boolean): void { if (zoomed !== this.zoomed) { this.zoomed = zoomed; this.model.forceLayout(); diff --git a/ivette/src/frama-c/plugins/eva/sized.tsx b/ivette/src/frama-c/plugins/eva/sized.tsx index 12aa6a5baae78301f30389d62d7fa6b9948ba2d4..fd764c348207d161f66b7f42a49e6b042a3248d9 100644 --- a/ivette/src/frama-c/plugins/eva/sized.tsx +++ b/ivette/src/frama-c/plugins/eva/sized.tsx @@ -38,7 +38,7 @@ export class Streamer { this.v0 = v0; } - push(v: number) { + push(v: number): void { const { vs } = this; vs.push(Math.round(v)); if (vs.length > 200) vs.shift(); @@ -71,7 +71,7 @@ export class FontSizer { this.p = new Streamer(p); } - push(x: number, y: number) { + push(x: number, y: number): void { const a0 = this.a; const b0 = this.b; if (x !== a0 && a0 !== 0) { @@ -84,19 +84,19 @@ export class FontSizer { this.b = y; } - capacity(y: number) { + capacity(y: number): number { const k = this.k.mean(); const p = this.p.mean(); return Math.round(0.5 + (y - p) / k); } - dimension(n: number) { + dimension(n: number): number { const k = this.k.mean(); const p = this.p.mean(); return p + n * k; } - dump(x: string) { + dump(x: string): string { const k = this.k.mean(); const p = this.p.mean(); return `${k}.${x}+${p}`; @@ -117,7 +117,7 @@ export interface SizedAreaProps { children?: React.ReactNode; } -export function SizedArea(props: SizedAreaProps) { +export function SizedArea(props: SizedAreaProps): JSX.Element { const { rows, cols, children } = props; const refSizer = React.useCallback( (ref: null | HTMLDivElement) => { diff --git a/ivette/src/frama-c/plugins/eva/stacks.ts b/ivette/src/frama-c/plugins/eva/stacks.ts index c1e83f5fae848ce6b4dfe2e49f86353668fd214a..45a28c043bec211b62a2ab872f59ec1e152cf5ef 100644 --- a/ivette/src/frama-c/plugins/eva/stacks.ts +++ b/ivette/src/frama-c/plugins/eva/stacks.ts @@ -64,7 +64,7 @@ export class StacksCache { this.model = state; } - clear() { + clear(): void { this.stacks.clear(); this.calls.clear(); } @@ -77,7 +77,7 @@ export class StacksCache { return this.summary.get(fct) ?? true; } - setSummary(fct: string, s: boolean) { + setSummary(fct: string, s: boolean): void { this.summary.set(fct, s); this.model.forceLayout(); } @@ -117,7 +117,7 @@ export class StacksCache { // --- Fetchers // -------------------------------------------------------------------------- - private requestStacks(key: string, markers: Ast.marker[]) { + private requestStacks(key: string, markers: Ast.marker[]): void { Server .send(Values.getCallstacks, markers) .then((stacks: callstacks) => { @@ -127,7 +127,7 @@ export class StacksCache { }); } - private requestCalls(cs: Values.callstack) { + private requestCalls(cs: Values.callstack): void { Server .send(Values.getCallstackInfo, cs) .then((calls) => { diff --git a/ivette/src/frama-c/plugins/eva/valueinfos.tsx b/ivette/src/frama-c/plugins/eva/valueinfos.tsx index fa0b9036db0679a62dcddfb6fe10328732ed81cf..c5e68c86fb58a15b744fd10db42f975c9bee8026 100644 --- a/ivette/src/frama-c/plugins/eva/valueinfos.tsx +++ b/ivette/src/frama-c/plugins/eva/valueinfos.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Info Components // -------------------------------------------------------------------------- diff --git a/ivette/src/frama-c/plugins/eva/valuetable.tsx b/ivette/src/frama-c/plugins/eva/valuetable.tsx index 4dba874b8515a39d15c6713b4c8beafead5db3e6..9105d796264c85ea9d8120b60bc5f0f52f4b2ced 100644 --- a/ivette/src/frama-c/plugins/eva/valuetable.tsx +++ b/ivette/src/frama-c/plugins/eva/valuetable.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Eva Values // -------------------------------------------------------------------------- diff --git a/ivette/src/frama-c/server.ts b/ivette/src/frama-c/server.ts index 5c1518902cb8c78c8b832155ed7873d8ee0c540c..8db960cbb0292f1ca51a2f791b1ae6605c910411 100644 --- a/ivette/src/frama-c/server.ts +++ b/ivette/src/frama-c/server.ts @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Connection to Frama-C Server // -------------------------------------------------------------------------- diff --git a/ivette/src/frama-c/states.ts b/ivette/src/frama-c/states.ts index 1ee7b2726b64d5821d6221b42f2d9f32890aa397..17b2cdecf005275456e90cd68e53e1b03c856608 100644 --- a/ivette/src/frama-c/states.ts +++ b/ivette/src/frama-c/states.ts @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Frama-C States // -------------------------------------------------------------------------- diff --git a/ivette/src/frama-c/utils.ts b/ivette/src/frama-c/utils.ts index 1fde188519e37b0bec10f4ef5c476f7877325a66..2bb2a6413569fea08c9055f62cd48c299a88aef7 100644 --- a/ivette/src/frama-c/utils.ts +++ b/ivette/src/frama-c/utils.ts @@ -49,7 +49,7 @@ export function printTextWithTags( buffer: DomeBuffers.RichTextBuffer, contents: KernelData.text, options?: DomeBuffers.MarkerProps, -) { +): void { if (Array.isArray(contents)) { let marker = false; const tag = contents.shift(); diff --git a/ivette/src/ivette/.eslintrc.json b/ivette/src/ivette/.eslintrc.json deleted file mode 100644 index fb24a7a0c7575b4542d30ec947c809f3bc8332a0..0000000000000000000000000000000000000000 --- a/ivette/src/ivette/.eslintrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "rules": { - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-function-return-type": "off" - } -} \ No newline at end of file diff --git a/ivette/src/ivette/index.tsx b/ivette/src/ivette/index.tsx index 1e710c2abcb336ca29871766d61fdd779a5c6338..1aee70298c070a6c723d9bfd28325136e4c5447c 100644 --- a/ivette/src/ivette/index.tsx +++ b/ivette/src/ivette/index.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + /* --------------------------------------------------------------------------*/ /* --- Lab View Component ---*/ /* --------------------------------------------------------------------------*/ diff --git a/ivette/src/ivette/prefs.tsx b/ivette/src/ivette/prefs.tsx index 645e90c1b2a30eff502430aa4fd9c3f48b4adaa0..f9805b624c387d9918989dcb9f7a0d401c46f78c 100644 --- a/ivette/src/ivette/prefs.tsx +++ b/ivette/src/ivette/prefs.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Main React Component rendered by './index.js' // -------------------------------------------------------------------------- diff --git a/ivette/src/ivette/sandbox.tsx b/ivette/src/ivette/sandbox.tsx index 89bb6ceae638109c50ba72e5516e0fe5e5f89934..621fd77f1dbb492bbd3ed8ebf8359c0d947a1ebf 100644 --- a/ivette/src/ivette/sandbox.tsx +++ b/ivette/src/ivette/sandbox.tsx @@ -29,6 +29,6 @@ import React from 'react'; import { Label } from 'dome/controls/labels'; -export default function Sandbox() { +export default function Sandbox(): JSX.Element { return <Label>Hello World!</Label>; } diff --git a/ivette/src/renderer/.eslintrc.json b/ivette/src/renderer/.eslintrc.json deleted file mode 100644 index fb24a7a0c7575b4542d30ec947c809f3bc8332a0..0000000000000000000000000000000000000000 --- a/ivette/src/renderer/.eslintrc.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "rules": { - "@typescript-eslint/no-explicit-any": "off", - "@typescript-eslint/explicit-function-return-type": "off" - } -} \ No newline at end of file diff --git a/ivette/src/renderer/Application.tsx b/ivette/src/renderer/Application.tsx index ec11b9c6bda4143e33fc2f60deaf46e7a29e49a6..e971b792274fb51fd49988fa4c430aa42dbf2343 100644 --- a/ivette/src/renderer/Application.tsx +++ b/ivette/src/renderer/Application.tsx @@ -41,13 +41,13 @@ import './loader'; // --- Main View // -------------------------------------------------------------------------- -export default function Application() { +export default function Application(): JSX.Element { const [sidebar, flipSidebar] = Dome.useFlipSettings('frama-c.sidebar.unfold', true); const [viewbar, flipViewbar] = Dome.useFlipSettings('frama-c.viewbar.unfold', true); const hints = Extensions.useSearchHints(); - const onSelectedHints = () => { + const onSelectedHints = (): void => { if (hints.length === 1) Extensions.onSearchHint(hints[0]); }; diff --git a/ivette/src/renderer/Controller.tsx b/ivette/src/renderer/Controller.tsx index 242ef6b018cd84fd214ded21ddc599acdf5b98ac..d3502219b8cbccef2d299873b38a95675f14a81d 100644 --- a/ivette/src/renderer/Controller.tsx +++ b/ivette/src/renderer/Controller.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Server Controller // -------------------------------------------------------------------------- diff --git a/ivette/src/renderer/Extensions.tsx b/ivette/src/renderer/Extensions.tsx index 8aebf063d490fa89e06d08d34b97a5f9a2dd1b8e..943fcaad75e0b9aa98bd85620040468f20bab788 100644 --- a/ivette/src/renderer/Extensions.tsx +++ b/ivette/src/renderer/Extensions.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + /* --------------------------------------------------------------------------*/ /* --- Ivette Extensions ---*/ /* --------------------------------------------------------------------------*/ diff --git a/ivette/src/renderer/Laboratory.tsx b/ivette/src/renderer/Laboratory.tsx index edeffafa31133bac158ad72491ff62cbfcdce585..ca134840350c750f4b010bb7c2fc7a45e60a9d43 100644 --- a/ivette/src/renderer/Laboratory.tsx +++ b/ivette/src/renderer/Laboratory.tsx @@ -20,6 +20,9 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + // -------------------------------------------------------------------------- // --- Lab View Component // -------------------------------------------------------------------------- diff --git a/ivette/src/renderer/Preferences.tsx b/ivette/src/renderer/Preferences.tsx index 654b661afd20ab7a7043c04abf74d3aef1217481..9638021ca3b6dc0b3dc385adeeceb3180500391e 100644 --- a/ivette/src/renderer/Preferences.tsx +++ b/ivette/src/renderer/Preferences.tsx @@ -20,6 +20,8 @@ /* */ /* ************************************************************************ */ +/* eslint-disable @typescript-eslint/explicit-function-return-type */ + // -------------------------------------------------------------------------- // --- Main React Component rendered by './index.js' // --------------------------------------------------------------------------