Skip to content

Commit

Permalink
Fix lint CI on cleaned repo
Browse files Browse the repository at this point in the history
  • Loading branch information
somebody1234 committed May 5, 2023
1 parent e1b4019 commit e23e65d
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 11 deletions.
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
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/*"]
}
}
}
6 changes: 5 additions & 1 deletion lib/rust/ensogl/pack/js/src/runner/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,11 @@ export function objectToGroup<T extends GroupObject>(
}
}
const description = obj.description
return new Group({ description, options, groups }) as ToGroup<T>
return new Group({
...(description ? { description } : {}),
...(options ? { options } : {}),
...(groups ? { 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/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

0 comments on commit e23e65d

Please sign in to comment.