From 3527a77eb640d424f06f5b8584cd84d3fb721453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B0=D1=82=D0=BE=D0=BB=D0=B8=D0=B9=20=D0=9C?= =?UTF-8?q?=D0=B0=D0=B9=D0=BE=D1=80=D0=BE=D0=B2?= Date: Sun, 23 Oct 2022 10:41:41 +0300 Subject: [PATCH] chore: configure eslint (#123) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added `eslint` to project and configured it. The fixes will be applied later. ``` Found 1855 problems (709 errors, 1146 warnings) 🙈 628 errors and 291 warnings potentially fixable with the `--fix` option. ``` --- .eslintignore | 2 ++ .eslintrc.json | 27 +++++++++++++++++++++++++++ package.json | 9 +++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.json diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 000000000..b4a4e4992 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +**/dist/** +**/node_modules/** \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..806637ede --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,27 @@ +{ + "root": true, + "env": { + "browser": true, + "es2020": true + }, + "plugins": [ + "@typescript-eslint", + "eslint-plugin-import" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "prettier" + ], + "rules": { + "no-misleading-character-class": "warn", + "no-dupe-else-if": "warn", + "no-warning-comments": "warn", + "import/no-absolute-path": "warn", + + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/no-unused-vars": "off" + } +} \ No newline at end of file diff --git a/package.json b/package.json index 66ba375ec..6ed3233a4 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,10 @@ "dev": "node ./scripts/dev", "bootstrap": "lerna bootstrap --no-ci", "postinstall": "lerna bootstrap --no-ci", - "docs": "jsdoc -c jsdoc.json" + "docs": "jsdoc -c jsdoc.json", + "lint": "eslint packages/**/**.ts", + "lint:fix": "eslint --fix packages/**/**.ts", + "prettier": "prettier --write packages/*/src/**/*.ts" }, "devDependencies": { "@babel/core": "^7.16.0", @@ -24,6 +27,8 @@ "@babel/preset-react": "^7.16.0", "@babel/preset-typescript": "^7.16.0", "@lerna/filter-options": "^4.0.0", + "@typescript-eslint/eslint-plugin": "^5.39.0", + "@typescript-eslint/parser": "^5.39.0", "babel-loader": "^8.2.3", "better-docs": "^2.3.2", "cross-env": "~7.0.3", @@ -31,7 +36,7 @@ "file-loader": "^6.2.0", "jsdoc": "^3.6.7", "lerna": "^4.0.0", - "prettier": "^2.5.0", + "prettier": "^2.7.1", "style-loader": "^3.3.1", "typedoc": "^0.23.15", "typescript": "^4.8.3",