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

refactor: lint #1032

Merged
merged 12 commits into from
Jun 11, 2024
Merged
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
9 changes: 7 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended-type-checked",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:prettier/recommended",
],
Expand All @@ -20,7 +20,12 @@
],
"root": true,
"rules": {
// disabled
// typescript-eslint
"@typescript-eslint/consistent-return": "error",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-redundant-type-constituents": "off",
"@typescript-eslint/no-unsafe-argument": "off",
Expand Down
410 changes: 210 additions & 200 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
"@changesets/cli": "^2.27.5",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-angular": "^19.3.0",
"@typescript-eslint/eslint-plugin": "^7.12.0",
"@typescript-eslint/parser": "^7.12.0",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
Expand All @@ -66,9 +66,9 @@
"husky": "^9.0.11",
"is-ci": "^3.0.1",
"minipass": "^7.1.2",
"prettier": "^3.3.1",
"prettier": "^3.3.2",
"tsup": "^8.1.0",
"turbo": "^2.0.1",
"turbo": "^2.0.3",
"typedoc": "^0.25.13",
"typescript": "5.4.5"
},
Expand Down
6 changes: 6 additions & 0 deletions packages/create-discordx/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# create-discordx

## 1.2.2

### Patch Changes

- lint

## 1.2.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/create-discordx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-discordx",
"version": "1.2.1",
"version": "1.2.2",
"description": "create discordx apps with one command",
"keywords": [
"bot",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-discordx/src/helper/package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export enum PackageManager {
}

export async function GetPackageManager(): Promise<PackageManager | null> {
const selected = await prompts<string>(
const selected = await prompts(
{
choices: [
{
Expand Down
7 changes: 4 additions & 3 deletions packages/create-discordx/src/helper/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,16 @@ export async function IsTemplateExist(name: string): Promise<boolean> {

async function downloadTar(url: string) {
const pipeline = promisify(Stream.pipeline);
const tempFile = join(tmpdir(), `discordx-template.temp-${Date.now()}`);
const tempFilename = `discordx-template.temp-${Date.now().toString()}`;
const tempFilePath = join(tmpdir(), tempFilename);

const request = await axios({
responseType: "stream",
url: url,
});

await pipeline(Readable.from(request.data), createWriteStream(tempFile));
return tempFile;
await pipeline(Readable.from(request.data), createWriteStream(tempFilePath));
return tempFilePath;
}

/**
Expand Down
9 changes: 4 additions & 5 deletions packages/create-discordx/src/helper/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ if (update) {
? "npm i -g create-discordx@latest"
: "npm i create-discordx@latest";

const template = `Update available ${chalk.dim(
`${packageJson.version}`,
)}${chalk.reset(" → ")}${chalk.green(`${update.latest}`)} \nRun ${chalk.cyan(
updateCmd,
)} to update`;
const updateVersion = packageJson.version;
const updateLatest = update.latest;
const updateCommand = updateCmd;
const template = `Update available ${chalk.dim(updateVersion)}${chalk.reset(" → ")}${chalk.green(updateLatest)} \nRun ${chalk.cyan(updateCommand)} to update`;

console.log(
boxen(template, {
Expand Down
4 changes: 2 additions & 2 deletions packages/create-discordx/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ console.log(`
██║ ██║██║╚════██║██║ ██║ ██║██╔══██╗██║ ██║ ██╔██╗
██████╔╝██║███████║╚██████╗╚██████╔╝██║ ██║██████╔╝██╔╝ ██╗
╚═════╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝
${chalk.dim(`v${version}`)}
${chalk.dim(`v${String(version)}`)}
`);

/**
Expand Down Expand Up @@ -95,7 +95,7 @@ if (!templateList.length) {
process.exit();
}

const response = await prompts<string>(
const response = await prompts(
{
choices: templateList,
message: "Pick template",
Expand Down
6 changes: 6 additions & 0 deletions packages/di/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @discordx/di

## 3.3.1

### Patch Changes

- lint

## 3.3.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/di/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@discordx/di",
"version": "3.3.0",
"version": "3.3.1",
"private": false,
"description": "dependency injection service with TSyringe support",
"keywords": [
Expand Down
1 change: 1 addition & 0 deletions packages/di/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type InstanceOf<T> = T extends new (...args: unknown[]) => infer R
*
* @category Internal
*/
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
export class DIService {
private static _engine: IDependencyRegistryEngine =
defaultDependencyRegistryEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { IDependencyRegistryEngine } from "../IDependencyRegistryEngine.js"
export class DefaultDependencyRegistryEngine
implements IDependencyRegistryEngine
{
private static _instance: DefaultDependencyRegistryEngine;
private static _instance: DefaultDependencyRegistryEngine | undefined;
private _services = new Map();

public static get instance(): DefaultDependencyRegistryEngine {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type Factory = <T>(factoryFunc: FactoryFunction<T>) => FactoryFunction<T>;
export class TsyringeDependencyRegistryEngine extends AbstractConfigurableDependencyInjector<DependencyContainer> {
public static token = Symbol("discordx");

private static _instance: TsyringeDependencyRegistryEngine;
private static _instance: TsyringeDependencyRegistryEngine | undefined;

private factory: Factory | null = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class TypeDiDependencyRegistryEngine extends AbstractConfigurableDependen
> {
public static token = new Token<unknown>("discordx");

private static _instance: TypeDiDependencyRegistryEngine;
private static _instance: TypeDiDependencyRegistryEngine | undefined;

private service: typeof Service | undefined;

Expand Down
10 changes: 10 additions & 0 deletions packages/discordx/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# discordx

## 11.9.4

### Patch Changes

- lint

- Updated dependencies []:
- @discordx/[email protected]
- @discordx/[email protected]

## 11.9.3

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/discordx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "discordx",
"version": "11.9.3",
"version": "11.9.4",
"private": false,
"description": "Create a discord bot with TypeScript and Decorators!",
"keywords": [
Expand Down Expand Up @@ -49,8 +49,8 @@
"test": "jest --detectOpenHandles"
},
"dependencies": {
"@discordx/di": "^3.3.0",
"@discordx/internal": "^1.1.1",
"@discordx/di": "^3.3.1",
"@discordx/internal": "^1.1.2",
"lodash": "^4.17.21",
"tslib": "^2.6.3"
},
Expand Down
Loading