Skip to content
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
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# from .gitignore
node_modules/
coverage/
dist/
.idea
.cache
*.tgz
.DS_Store
esm
esnext

# custom ignore pattern
*.html
50 changes: 50 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"plugins": ["@typescript-eslint"],
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended",
"prettier"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"rules": {
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
"accessibility": "no-public",
"overrides": {
"parameterProperties": "explicit"
}
}
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": false }],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/ban-ts-comment": "off",
"no-console": ["error", { "allow": ["warn", "error"] }]
},
"settings": {
"react": {
"version": "detect"
}
},
"env": {
"browser": true,
"es6": true
},
"parserOptions": {
"project": "./tsconfig.json",
"extraFileExtensions": [".html"],
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
}
}
9 changes: 0 additions & 9 deletions jest.config.js

This file was deleted.

19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
},
"homepage": "https://github.com/LeetCode-OpenSource/typed-path-generator#readme",
"scripts": {
"test": "jest",
"build": "rm -rf ./dist && tsc -p ./tsconfig.json"
"build": "rm -rf ./dist && tsc -p ./tsconfig.json",
"lint": "yarn lint:eslint && yarn lint:tsc",
"lint:eslint": "eslint . --ext .ts,.tsx --fix --max-warnings 0"
},
"keywords": [
"route",
Expand All @@ -36,26 +37,24 @@
"lint-staged": {
"*.{ts,tsx}": [
"prettier --write",
"tslint -p tsconfig.json --fix",
"yarn lint:eslint",
"git add"
]
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/jest": "^26.0.0",
"@types/js-yaml": "^4.0.0",
"@types/lodash": "^4.14.122",
"@types/node": "^14.0.1",
"@types/prettier": "^2.0.0",
"@types/qs": "^6.5.2",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"eslint": "7.22.0",
"eslint-config-prettier": "^8.1.0",
"husky": "^5.2.0",
"jest": "^25.1.0",
"lint-staged": "^10.0.1",
"ts-jest": "^25.0.0",
"tslint": "^5.13.1",
"tslint-eslint-rules": "^5.4.0",
"tslint-sonarts": "^1.9.0",
"typescript": "^3.3.3333"
"typescript": "^4.2"
},
"dependencies": {
"chalk": "^4.0.0",
Expand Down
6 changes: 3 additions & 3 deletions src/cli/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ interface ImportInfo {
}

interface ParseResult {
staticPath: { [key: string]: object | string }
pathFactory: { [key: string]: object | string }
ParamsInterface: { [key: string]: object | string }
staticPath: { [key: string]: Record<string, unknown> | string }
pathFactory: { [key: string]: Record<string, unknown> | string }
ParamsInterface: { [key: string]: Record<string, unknown> | string }
importInfo: ImportInfo
}

Expand Down
2 changes: 1 addition & 1 deletion src/cli/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class Logger extends BasicLogger {
super()
}

log(message: string, status: LoggerStatus) {
log(message: string, status: LoggerStatus): void {
Logger.updateInfos({ key: this.key, message, status })
}
}
10 changes: 5 additions & 5 deletions src/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const getDefaultOptions = (): Options => ({
},
})

export function codeStringify(code: object): string {
export function codeStringify(code: Record<string, unknown>): string {
const replaceInfo: { origin: string; stringified: string }[] = []
const stringifiedCode = JSON.stringify(code, collectReplaceInfo)

Expand All @@ -30,7 +30,7 @@ export function codeStringify(code: object): string {
stringifiedCode,
)

function collectReplaceInfo(_key: string, value: string | object) {
function collectReplaceInfo(_key: string, value: string | Record<string, unknown>) {
if (typeof value === 'string') {
replaceInfo.push({
origin: value,
Expand All @@ -52,10 +52,10 @@ export function loadYAML(yaml: string): YAML {
}

export function recursiveForEach<Output>(
obj: any,
obj: Record<string, any>,
translate: (value: any, path: string[]) => Output,
parentPath: string[] = [],
) {
): void {
Object.keys(obj).forEach((key) => {
const currentPath = [...parentPath, key]
const value = obj[key]
Expand Down Expand Up @@ -146,6 +146,6 @@ function makeTypeString(Type: ParamsType) {
}
}

export function mergeTypeString(...types: string[]) {
export function mergeTypeString(...types: string[]): string {
return types.filter(Boolean).join(' & ')
}
59 changes: 0 additions & 59 deletions tslint.json

This file was deleted.

Loading