diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..8932a0de --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,22 @@ +module.exports = { + root: true, + parser: "@typescript-eslint/parser", + parserOptions: { + "project": "./tsconfig.json" + }, + ignorePatterns: ['*.test.ts', '.eslintrc.js', 'webpack.config.js', '*.js'], + overrides: [{ + files: ['*.ts', '*.tsx'], + }], + plugins: [ + "@typescript-eslint", + ], + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + rules: { + '@typescript-eslint/no-floating-promises': 'error', + } + } \ No newline at end of file diff --git a/package.json b/package.json index 2a813abc..11878960 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "js/index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "webpack" + "build": "webpack", + "lint": "eslint hwe/ts ts" }, "repository": { "type": "git", @@ -22,14 +23,18 @@ "@babel/core": "^7.15.0", "@babel/preset-env": "^7.15.0", "@babel/preset-typescript": "^7.15.0", + "@typescript-eslint/eslint-plugin": "^4.29.1", + "@typescript-eslint/parser": "^4.29.1", "babel-loader": "^8.2.2", "babel-plugin-lodash": "^3.3.4", + "eslint": "^7.32.0", "pre-commit": "^1.2.2", "typescript": "^4.3.5", "webpack": "^5.49.0", "webpack-cli": "^4.7.2" }, "pre-commit": [ + "lint", "build" ] }