Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
chore: tslint -> eslint (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
RasPhilCo authored Nov 22, 2019
1 parent e96277c commit 30d9307
Show file tree
Hide file tree
Showing 20 changed files with 1,299 additions and 661 deletions.
8 changes: 7 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"extends": "oclif"
"extends": [
"oclif",
"oclif-typescript"
],
"rules": {
"unicorn/no-abusive-eslint-disable": "off"
}
}
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"tslib": "^1.9.3"
},
"devDependencies": {
"@oclif/tslint": "^3.1.1",
"@types/chai": "^4.1.7",
"@types/indent-string": "^3.2.0",
"@types/lodash": "^4.14.123",
Expand All @@ -21,13 +20,15 @@
"@types/wrap-ansi": "^3.0.0",
"chai": "^4.2.0",
"conventional-changelog-cli": "^2.0.21",
"eslint": "^6.6.0",
"eslint-config-oclif": "^3.1.0",
"eslint-config-oclif-typescript": "^0.1.0",
"fancy-test": "^1.4.3",
"globby": "^9.2.0",
"lodash": "^4.17.11",
"mocha": "^6.1.4",
"proxyquire": "^2.1.0",
"ts-node": "^8.1.0",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
},
"engines": {
Expand All @@ -45,11 +46,12 @@
"repository": "oclif/config",
"scripts": {
"build": "rm -rf lib && tsc",
"lint": "tsc -p test --noEmit && tslint -p test",
"posttest": "yarn run lint",
"lint": "eslint . --ext .ts --config .eslintrc",
"posttest": "yarn lint",
"prepack": "yarn run build",
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md"
"version": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 && git add CHANGELOG.md",
"pretest": "tsc -p test --noEmit"
},
"types": "lib/index.d.ts"
}
99 changes: 50 additions & 49 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,82 +4,83 @@ import * as Config from '.'
import {mapValues} from './util'

export interface Command {
id: string
hidden: boolean
aliases: string[]
description?: string
usage?: string | string[]
examples?: string[]
type?: string
pluginName?: string
pluginType?: string
flags: {[name: string]: Command.Flag}
args: Command.Arg[]
id: string;
hidden: boolean;
aliases: string[];
description?: string;
usage?: string | string[];
examples?: string[];
type?: string;
pluginName?: string;
pluginType?: string;
flags: {[name: string]: Command.Flag};
args: Command.Arg[];
}

export namespace Command {
export interface Arg {
name: string
description?: string
required?: boolean
hidden?: boolean
default?: string
options?: string[]
name: string;
description?: string;
required?: boolean;
hidden?: boolean;
default?: string;
options?: string[];
}

export type Flag = Flag.Boolean | Flag.Option

export namespace Flag {
export interface Boolean {
type: 'boolean'
name: string
required?: boolean
char?: string
hidden?: boolean
description?: string
helpLabel?: string
allowNo?: boolean
type: 'boolean';
name: string;
required?: boolean;
char?: string;
hidden?: boolean;
description?: string;
helpLabel?: string;
allowNo?: boolean;
}
export interface Option {
type: 'option'
name: string
required?: boolean
char?: string
hidden?: boolean
description?: string
helpLabel?: string
helpValue?: string
default?: string
options?: string[]
type: 'option';
name: string;
required?: boolean;
char?: string;
hidden?: boolean;
description?: string;
helpLabel?: string;
helpValue?: string;
default?: string;
options?: string[];
}
}

export interface Base {
_base: string
id: string
hidden: boolean
aliases: string[]
description?: string
usage?: string | string[]
examples?: string[]
_base: string;
id: string;
hidden: boolean;
aliases: string[];
description?: string;
usage?: string | string[];
examples?: string[];
}

export interface Class extends Base {
plugin?: Config.IPlugin
flags?: Parser.flags.Input<any>
args?: Parser.args.Input
new(argv: string[], config: Config.IConfig): Instance
run(argv?: string[], config?: Config.LoadOptions): PromiseLike<any>
plugin?: Config.IPlugin;
flags?: Parser.flags.Input<any>;
args?: Parser.args.Input;
new(argv: string[], config: Config.IConfig): Instance;
run(argv?: string[], config?: Config.LoadOptions): PromiseLike<any>;
}

export interface Instance {
_run(argv: string[]): Promise<any>
_run(argv: string[]): Promise<any>;
}

export interface Plugin extends Command {
load(): Class
load(): Class;
}

// eslint-disable-next-line no-inner-declarations
export function toCached(c: Class, plugin?: Config.Plugin): Command {
return {
id: c.id,
Expand Down
Loading

0 comments on commit 30d9307

Please sign in to comment.