Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actually fix Lint CI #6583

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/ide-desktop/lib/client/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"baseUrl": "./src",
"esModuleInterop": true
"esModuleInterop": true,
"paths": {
"runner/*": ["../../../../../lib/rust/ensogl/pack/js/src/runner/*"]
}
},
"include": ["../types", "."]
}
3 changes: 3 additions & 0 deletions app/ide-desktop/lib/content-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
},
"bugs": {
"url": "https://github.com/enso-org/enso/issues"
},
"scripts": {
"typecheck": "tsc --noEmit"
}
}
2 changes: 1 addition & 1 deletion app/ide-desktop/lib/content/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as semver from 'semver'
import * as authentication from 'enso-authentication'
import * as contentConfig from 'enso-content-config'

import * as app from '../../../../../target/ensogl-pack/linked-dist/index'
import * as app from '../../../../../target/ensogl-pack/linked-dist'
import GLOBAL_CONFIG from '../../../../gui/config.yaml' assert { type: 'yaml' }

const logger = app.log.logger
Expand Down
33 changes: 30 additions & 3 deletions app/ide-desktop/lib/types/modules.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*
* This file MUST NOT `export {}` for the modules to be visible to other files. */

// Required because this is a build artifact and so would not otherwise work on a clean repository.
declare module '*/build.json' {
interface BuildInfo {
commit: string
Expand All @@ -14,9 +15,35 @@ declare module '*/build.json' {
export default BUILD_INFO
}

// Required because this is a build artifact and so would not otherwise work on a clean repository.
declare module '*/ensogl-pack/linked-dist' {
// eslint-disable-next-line no-restricted-syntax
export * from '../../../../lib/rust/ensogl/pack/js/src/runner/index'
/* eslint-disable @typescript-eslint/consistent-type-imports, no-restricted-syntax, @typescript-eslint/no-shadow */
export type App = import('runner/index').App
export const App: typeof import('runner/index').App
export type Consumer = import('runner/index').Consumer
export const Consumer: typeof import('runner/index').Consumer
export type LogLevel = import('runner/index').LogLevel
export const LogLevel: typeof import('runner/index').LogLevel
export type Logger = import('runner/index').Logger
export const Logger: typeof import('runner/index').Logger
export type Option<T> = import('runner/index').Option<T>
export const Option: typeof import('runner/index').Option
export const log: typeof import('runner/index').log
export const logger: typeof import('runner/index').logger
export const urlParams: typeof import('runner/index').urlParams
export namespace config {
export type Option<T> = import('runner/index').config.Option<T>
export const Option: typeof import('runner/index').config.Option
export type Group<
Options extends OptionsRecord,
Groups extends GroupsRecord
> = typeof import('runner/index').config.Group<Options, Groups>
export const Group: typeof import('runner/index').config.Group
export const objectToGroup: typeof import('runner/index').config.objectToGroup
export const objectToOption: typeof import('runner/index').config.objectToOption
Comment on lines +20 to +43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is terribly verbose and hard to maintain. I understand that the second PR is an alternative to this one, without this verbosity. Am I correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - i definitely agree the other one is cleaner... and more importantly, doesnt require manually adding or removing exports

export const options: typeof import('runner/index').config.options
}
/* eslint-enable @typescript-eslint/consistent-type-imports, no-restricted-syntax, @typescript-eslint/no-shadow */
}

declare module '*/gui/config.yaml' {
Expand Down Expand Up @@ -75,7 +102,7 @@ declare module 'create-servers' {

interface CreateServersOptions {
http: number
handler: http.RequestListener<http.IncomingMessage, http.ServerResponse>
handler: http.RequestListener
}
interface HttpError {
http: string
Expand Down
4 changes: 4 additions & 0 deletions app/ide-desktop/lib/types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.json",
"include": ["."]
}
2 changes: 1 addition & 1 deletion app/ide-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@
"watch": "npm run watch --workspace enso-content",
"watch-dashboard": "npm run watch --workspace enso-dashboard",
"build-dashboard": "npm run build --workspace enso-dashboard",
"typecheck": "npm run typecheck --workspace enso && npm run typecheck --workspace enso-content && npm run typecheck --workspace enso-dashboard && npm run typecheck --workspace enso-authentication"
"typecheck": "npx tsc --noEmit -p lib/types/tsconfig.json && npm run typecheck --workspace enso-content-config && npm run typecheck --workspace enso && npm run typecheck --workspace enso-content && npm run typecheck --workspace enso-dashboard && npm run typecheck --workspace enso-authentication"
}
}
5 changes: 4 additions & 1 deletion app/ide-desktop/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"sourceMap": true,
"skipLibCheck": true,
"target": "ES2019",
"jsx": "react-jsx"
"jsx": "react-jsx",
"paths": {
"runner/*": ["../../lib/rust/ensogl/pack/js/src/runner/*"]
}
}
}
7 changes: 5 additions & 2 deletions lib/rust/ensogl/pack/js/src/runner/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,11 @@ export function objectToGroup<T extends GroupObject>(
groups[name] = objectToGroup(group, scope)
}
}
const description = obj.description
return new Group({ description, options, groups }) as ToGroup<T>
return new Group({
...(obj.description ? { description: obj.description } : {}),
options,
groups,
}) as ToGroup<T>
}

/** Convert the plain option object to an `Option` object instance. */
Expand Down
8 changes: 6 additions & 2 deletions lib/rust/ensogl/pack/js/src/runner/debug/help-screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export class HelpScreenSection {
entries: HelpScreenEntry[]
constructor(cfg: { name: string; description?: string; entries: HelpScreenEntry[] }) {
this.name = cfg.name
this.description = cfg.description
if (cfg.description != null) {
this.description = cfg.description
}
this.entries = cfg.entries
}
}
Expand All @@ -31,7 +33,9 @@ export class HelpScreenEntry {
constructor(name: string, values: string[], href?: string) {
this.name = name
this.values = values
this.href = href
if (href != null) {
this.href = href
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/rust/ensogl/pack/js/src/runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ export class App {
}
}
/** Sets application stop to true and calls drop method which removes all rust memory references
* and calls all destructors. */
* and calls all destructors. */
stop() {
this.stopped = true
this.wasm?.drop()
Expand Down
2 changes: 1 addition & 1 deletion lib/rust/ensogl/pack/js/src/runner/log/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class Console extends Consumer {
const coloredArgs: string[] = color ? strArgs.map(arg => Colors[color](arg)) : strArgs
if (this.indentLvl > 0) {
const indent = this.indent()
const indentedArgs = coloredArgs.map(arg => arg.replaceAll('\n', `\n${indent}`))
const indentedArgs = coloredArgs.map(arg => arg.replace(/\n/g, `\n${indent}`))
c.log(this.indentShorter(), ...indentedArgs)
} else {
c.log(...coloredArgs)
Expand Down