Skip to content

Commit

Permalink
integrate bun, clean type/lint errors, autofix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinciarka committed Sep 11, 2023
1 parent fa3b67a commit a098c8a
Show file tree
Hide file tree
Showing 14 changed files with 191 additions and 276 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
20 changes: 20 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "sort-imports-es6-autofix"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"root": true,
"rules": {
"sort-imports-es6-autofix/sort-imports-es6": [
2,
{
"ignoreCase": false,
"ignoreMemberSort": false,
"memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
}
]
},
"env": {
"node": true,
"es6": true
}
}
Binary file added bun.lockb
Binary file not shown.
7 changes: 1 addition & 6 deletions configs/oasis-borrow/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { ConfigHelperType } from "⌨️";

export default function ({
isProduction,
isStaging,
isDevelopment,
notProduction,
}: ConfigHelperType) {
export default function ({ isProduction, notProduction }: ConfigHelperType) {
return {
TestFeature: false, // used in unit tests
AnotherTestFeature: true, // used in unit tests
Expand Down
7 changes: 1 addition & 6 deletions configs/test-config/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { ConfigHelperType } from "⌨️";

export default function ({
isProduction,
isStaging,
isDevelopment,
notProduction,
}: ConfigHelperType) {
export default function ({ isStaging, notProduction }: ConfigHelperType) {
return {
TestConfigTestValueAlwaysTrue: true,
TestConfigTestValueAlwaysFalse: false,
Expand Down
185 changes: 0 additions & 185 deletions eslintrs.json

This file was deleted.

2 changes: 1 addition & 1 deletion helpers/create-config-files.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { existsSync, mkdirSync, promises } from "fs";
import { ConfigModule, Environments } from "⌨️";
import { existsSync, mkdirSync, promises } from "fs";

export const createConfigFiles = async (configs: {
[configName: string]: Record<Environments, ConfigModule>;
Expand Down
2 changes: 1 addition & 1 deletion helpers/generate-configs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { green, italic, yellow } from "kleur";
import { createConfigFiles, getConfigMainModules, parseConfig } from "🛠️";
import { green, italic, yellow } from "kleur";

const generatingTimeStart = Date.now();

Expand Down
2 changes: 1 addition & 1 deletion helpers/get-config-main-modules.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readdir } from "fs/promises";
import { constants } from "🛠️";
import { readdir } from "fs/promises";

export const getConfigMainModules = async () =>
await readdir(constants.configFolder);
2 changes: 1 addition & 1 deletion helpers/get-environments.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ConfigHelperType, Environments } from "⌨️";
import { constants } from "🛠️";
import { ConfigHelperType, ConfigModule, Environments } from "⌨️";

export const getEnvironments: Record<Environments, ConfigHelperType> =
constants.environments.reduce(
Expand Down
10 changes: 4 additions & 6 deletions helpers/parse-config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { join } from "path";
import { ConfigModule, Environments } from "⌨️";
import { constants, getEnvironments } from "🛠️";
import { join } from "path";

export const parseConfig = async (configModuleFolder: string) => {
const tempConfigModule = require(join(
constants.configFolder,
configModuleFolder,
"index.ts"
)).default as ConfigModule;
const { default: tempConfigModule } = (await import(
join(constants.configFolder, configModuleFolder, "index.ts")
)) as { default: ConfigModule };
return {
[configModuleFolder]: constants.environments.reduce(
(acc, env) => ({
Expand Down
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"description": "",
"main": "index.js",
"scripts": {
"build": "rimraf dist; ts-node ./index.ts",
"lint": "eslint --ext .ts ."
"dle": "rimraf dist; ts-node ./index.ts",
"lint": "eslint --ext .ts .",
"lint:fix": "eslint --fix --ext .ts ."
},
"repository": {
"type": "git",
Expand All @@ -18,15 +19,15 @@
},
"homepage": "https://github.com/OasisDEX/oazo-configuration#readme",
"dependencies": {
"eslint": "^8.48.0",
"@types/node": "^20.5.9",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.1.0",
"eslint-plugin-sort-imports-es6-autofix": "^0.6.0",
"kleur": "^4.1.5",
"rimraf": "^5.0.1",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"devDependencies": {
"@types/node": "^20.5.9",
"@typescript-eslint/parser": "^6.6.0",
"tsconfig-paths": "^4.2.0"
"tsconfig-paths": "^4.2.0",
"typescript": "5.1.6"
}
}
12 changes: 11 additions & 1 deletion types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,14 @@ export type ConfigHelperType = {
notDevelopment: boolean;
};

export type ConfigModule = (args: ConfigHelperType) => Record<string, any>;
type ConfigModulePiece =
| string
| number
| boolean
| null
| undefined
| { [name: string]: ConfigModulePiece }
| ConfigModulePiece[];
export type ConfigModule = (
args: ConfigHelperType
) => Record<string, ConfigModulePiece>;
Loading

0 comments on commit a098c8a

Please sign in to comment.