diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..9b26ed0 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +node_modules +lib \ No newline at end of file diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..924f042 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,18 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "plugins": [ + "@typescript-eslint", + "prettier" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "prettier" + ], + "rules": { + "no-console": 1, // Means warning + "prettier/prettier": 2 // Means error + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 3c3629e..1f34459 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ node_modules +lib +bundle.js diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..73e070e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "printWidth": 120, + "trailingComma": "all" +} \ No newline at end of file diff --git a/ESPLoader.js b/ESPLoader.js index aaa02c8..e92f0c4 100644 --- a/ESPLoader.js +++ b/ESPLoader.js @@ -250,7 +250,7 @@ class ESPLoader { //var str = new TextDecoder().decode(res); //this.log(str); } catch (e) { - if (e instanceof TimeoutError) { + if (e instanceof Error) { break; } } @@ -263,7 +263,7 @@ class ESPLoader { var resp = await this.sync(); return "success"; } catch(error) { - if (error instanceof TimeoutError) { + if (error instanceof Error) { if (esp32r0_delay) { this.write_char('_'); } else { diff --git a/README.md b/README.md index 1848529..cccc4f6 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,11 @@ Visit https://espressif.github.io/esptool-js/ to see this tool in action. ``` npm install +npm run rollup python3 -m http.server 8008 ``` -Then open http://localhost:8008 in Chrome or Edge. +Then open http://localhost:8008 in Chrome or Edge. `npm run rollup` to build the `bundle.js` used in the example `index.html`. ## License diff --git a/index.html b/index.html index 8c6d318..c8dccf9 100644 --- a/index.html +++ b/index.html @@ -11,8 +11,8 @@ /> - + @@ -73,8 +73,7 @@
- - +