diff --git a/.eslintrc.js b/.eslintrc.js index 6e9d8a07..8378c1af 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,16 +1,20 @@ module.exports = { - parser: 'babel-eslint', + parser: '@typescript-eslint/parser', + plugins: ['@typescript-eslint'], env: { node: true, commonjs: true, es6: true, + browser: true, }, - extends: 'eslint:recommended', + extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], parserOptions: { sourceType: 'module', }, rules: { quotes: ['error', 'single'], 'prefer-const': 2, + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-var-requires': 'off', }, }; diff --git a/CHANGELOG.md b/CHANGELOG.md index 4382248c..630f322f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.6.0 (15 Aug 2022) + +* feat: support basePath +* feat: support proxy + ## 1.5.0 (7 Aug 2022) * feat: support https diff --git a/package.json b/package.json index 6551bf81..bdac7410 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chii", - "version": "1.5.0", + "version": "1.6.0", "description": "Chrome devtools framework", "main": "./server/index.js", "bin": { @@ -22,7 +22,7 @@ "dev:front_end": "cd devtools/devtools-frontend && gn gen out/Default && autoninja -C out/Default && lsla shx cp -R out/Default/gen/front_end ../../public", "lint": "npm run lint:server && npm run lint:target", "lint:server": "eslint \"server/**/*.js\" \"bin/*.js\"", - "lint:target": "tslint \"target/**/*.ts\"", + "lint:target": "eslint \"src/**/*.ts\"", "init:front_end": "cd devtools && rm -rf devtools-frontend && gclient sync --with_branch_heads --verbose && cd ../ && python3 script/apply_all_patches.py patches/config.json", "es5": "es-check es5 public/target.js" }, @@ -40,18 +40,19 @@ }, "homepage": "https://github.com/liriliri/chii#readme", "devDependencies": { + "@typescript-eslint/eslint-plugin": "^5.33.0", + "@typescript-eslint/parser": "^5.33.0", "babel-eslint": "^10.1.0", "chobitsu": "^1.2.1", "es-check": "^6.2.1", - "eslint": "^6.8.0", + "eslint": "^8.22.0", + "eslint-config-prettier": "^8.5.0", "gulp": "^4.0.2", "gulp-clean": "^0.4.0", "gulp-uglify-es": "^3.0.0", "ncp": "^2.0.0", "terser": "^5.10.0", "ts-loader": "^9.3.1", - "tslint": "^6.1.2", - "tslint-config-prettier": "^1.18.0", "typescript": "^3.8.3", "webpack": "^5.73.0", "webpack-cli": "^4.10.0" diff --git a/src/index.ts b/src/index.ts index f9c2be43..0d0de5b5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,10 +29,7 @@ const start = Date.now(); setInterval(() => { fetch(`${window.basePath}timestamp`) .then(res => res.text()) - .then( - timestamp => { - if (toInt(timestamp) > start) location.reload(); - }, - () => {} - ); + .then(timestamp => { + if (toInt(timestamp) > start) location.reload(); + }); }, 2000); diff --git a/src/target/DevtoolsFrame.ts b/src/target/DevtoolsFrame.ts index cda7ff84..c9c8a0a5 100644 --- a/src/target/DevtoolsFrame.ts +++ b/src/target/DevtoolsFrame.ts @@ -16,8 +16,8 @@ export default class DevtoolsFrame { private $container: $.$; private $draggable: $.$; private height: number; - private startY: number = 0; - private originHeight: number = 0; + private startY = 0; + private originHeight = 0; constructor() { this.container = h('.__chobitsu-hide__') as HTMLDivElement; this.$container = $(this.container); diff --git a/src/target/util.ts b/src/target/util.ts index f133af87..cd15c931 100644 --- a/src/target/util.ts +++ b/src/target/util.ts @@ -17,6 +17,7 @@ export function getFavicon() { let favicon = location.origin + '/favicon.ico'; const $link = $('link'); + /* eslint-disable-next-line */ $link.each(function (this: HTMLElement) { if (contain(this.getAttribute('rel') || '', 'icon')) { const href = this.getAttribute('href'); diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 1793f373..00000000 --- a/tslint.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "defaultSeverity": "error", - "extends": ["tslint:recommended", "tslint-config-prettier"], - "jsRules": {}, - "rules": { - "object-literal-sort-keys": false, - "only-arrow-functions": false, - "no-shadowed-variable": false, - "member-access": false, - "max-classes-per-file": false, - "ban-types": false - }, - "rulesDirectory": [] -}