diff --git a/packages/collector/.eslintrc.json b/packages/collector/.eslintrc.json index 143fd8f9f..91269149e 100644 --- a/packages/collector/.eslintrc.json +++ b/packages/collector/.eslintrc.json @@ -9,6 +9,7 @@ "plugins": [ "deprecation", "jest", + "prefer-arrow-functions", "simple-import-sort", "@typescript-eslint" ], @@ -19,11 +20,19 @@ "plugin:prettier/recommended" ], "rules": { - "deprecation/deprecation": "warn", + "arrow-body-style": ["error", "as-needed"], + "camelcase": ["error", {"allow": ["html_url", "per_page"]}], "no-warning-comments": "warn", + "strict": ["error", "never"], + "deprecation/deprecation": "warn", + "prefer-arrow-functions/prefer-arrow-functions": [ + "error", + { + "allowNamedFunctions": true + } + ], "simple-import-sort/imports": "error", "simple-import-sort/exports": "error", - "strict": ["error", "never"], "@typescript-eslint/array-type": ["error", { "default": "generic" }], "@typescript-eslint/consistent-type-exports": "error", "@typescript-eslint/consistent-type-imports": "error", diff --git a/packages/collector/package-lock.json b/packages/collector/package-lock.json index 5d18458e8..28ea589e3 100644 --- a/packages/collector/package-lock.json +++ b/packages/collector/package-lock.json @@ -23,6 +23,7 @@ "eslint-config-prettier": "^9.0.0", "eslint-plugin-deprecation": "^2.0.0", "eslint-plugin-jest": "^27.4.3", + "eslint-plugin-prefer-arrow-functions": "^3.2.4", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-simple-import-sort": "^10.0.0", "jest": "^29.7.0", @@ -3218,6 +3219,15 @@ } } }, + "node_modules/eslint-plugin-prefer-arrow-functions": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-prefer-arrow-functions/-/eslint-plugin-prefer-arrow-functions-3.2.4.tgz", + "integrity": "sha512-HbPmlbO/iYQeVs2fuShNkGVJDfVfgSd84Vzxv+xlh+nIVoSsZvTj6yOqszw4mtG9JbiqMShVWqbVeoVsejE59w==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, "node_modules/eslint-plugin-prettier": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz", @@ -9217,6 +9227,13 @@ "@typescript-eslint/utils": "^5.10.0" } }, + "eslint-plugin-prefer-arrow-functions": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-prefer-arrow-functions/-/eslint-plugin-prefer-arrow-functions-3.2.4.tgz", + "integrity": "sha512-HbPmlbO/iYQeVs2fuShNkGVJDfVfgSd84Vzxv+xlh+nIVoSsZvTj6yOqszw4mtG9JbiqMShVWqbVeoVsejE59w==", + "dev": true, + "requires": {} + }, "eslint-plugin-prettier": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz", diff --git a/packages/collector/package.json b/packages/collector/package.json index bb83bf86f..de40f0577 100644 --- a/packages/collector/package.json +++ b/packages/collector/package.json @@ -33,6 +33,7 @@ "eslint-config-prettier": "^9.0.0", "eslint-plugin-deprecation": "^2.0.0", "eslint-plugin-jest": "^27.4.3", + "eslint-plugin-prefer-arrow-functions": "^3.2.4", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-simple-import-sort": "^10.0.0", "jest": "^29.7.0", diff --git a/packages/collector/src/getProjectInfo.ts b/packages/collector/src/getProjectInfo.ts index 9d3e1c168..c449542c3 100644 --- a/packages/collector/src/getProjectInfo.ts +++ b/packages/collector/src/getProjectInfo.ts @@ -11,7 +11,7 @@ export async function getProjectInfo(project: Project): Promise { repo: project.repo, path: ".project-info.json", }) - .catch(function (e): never { + .catch((e): never => { throw new ProjectInfoError(String(e)); }); const encodedContent = (rawResponse.data as { content?: string }).content; diff --git a/packages/collector/src/getProjectIssues.ts b/packages/collector/src/getProjectIssues.ts index eb74dbd21..4801e493b 100644 --- a/packages/collector/src/getProjectIssues.ts +++ b/packages/collector/src/getProjectIssues.ts @@ -16,7 +16,7 @@ export async function getProjectIssues( per_page: 100, labels: issueLabel, }) - .catch(function (e): never { + .catch((e): never => { throw new IssueListError(String(e)); }); return issues.data.map((issue) => ({ diff --git a/packages/collector/src/getProjectVisibility.ts b/packages/collector/src/getProjectVisibility.ts index f6d4741da..223752cb1 100644 --- a/packages/collector/src/getProjectVisibility.ts +++ b/packages/collector/src/getProjectVisibility.ts @@ -5,7 +5,7 @@ import { octokit } from "./octokit"; export async function getProjectVisibility(project: Project): Promise { const rawResponse = await octokit.rest.repos .get({ ...project }) - .catch(function (e): never { + .catch((e): never => { throw new VisibilityError(String(e)); }); return !rawResponse.data.private; diff --git a/packages/frontend/.eslintrc.json b/packages/frontend/.eslintrc.json index b3bc08249..960d9bf86 100644 --- a/packages/frontend/.eslintrc.json +++ b/packages/frontend/.eslintrc.json @@ -8,7 +8,10 @@ "node": false }, "plugins": [ + "compat", "deprecation", + "jest", + "prefer-arrow-functions", "simple-import-sort", "@typescript-eslint" ], @@ -21,8 +24,18 @@ "plugin:prettier/recommended" ], "rules": { - "deprecation/deprecation": "warn", + "arrow-body-style": ["error", "as-needed"], + "camelcase": "error", "no-warning-comments": "warn", + "strict": ["error", "never"], + "compat/compat": "warn", + "deprecation/deprecation": "warn", + "prefer-arrow-functions/prefer-arrow-functions": [ + "error", + { + "allowNamedFunctions": true + } + ], "simple-import-sort/imports": "error", "simple-import-sort/exports": "error", "@typescript-eslint/array-type": ["error", { "default": "generic" }], diff --git a/packages/frontend/package-lock.json b/packages/frontend/package-lock.json index be31758fc..89d071e1a 100644 --- a/packages/frontend/package-lock.json +++ b/packages/frontend/package-lock.json @@ -30,8 +30,10 @@ "babel-preset-react-app": "^10.0.1", "eslint": "^8.52.0", "eslint-config-prettier": "^9.0.0", + "eslint-plugin-compat": "^4.2.0", "eslint-plugin-deprecation": "^2.0.0", "eslint-plugin-jest": "^27.4.3", + "eslint-plugin-prefer-arrow-functions": "^3.2.4", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-react": "^7.33.2", "eslint-plugin-simple-import-sort": "^10.0.0", @@ -3163,6 +3165,12 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", "dev": true }, + "node_modules/@mdn/browser-compat-data": { + "version": "5.3.26", + "resolved": "https://registry.npmjs.org/@mdn/browser-compat-data/-/browser-compat-data-5.3.26.tgz", + "integrity": "sha512-fjXsjZJvdnC+j4AipnxHbwPCohV0cC1qLh3XHy2+zeXLDb1TVepLK7qDS9UcvNxuEkl/qYPsBf0lad2paHSuIQ==", + "dev": true + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -4685,6 +4693,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ast-metadata-inferer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/ast-metadata-inferer/-/ast-metadata-inferer-0.8.0.tgz", + "integrity": "sha512-jOMKcHht9LxYIEQu+RVd22vtgrPaVCtDRQ/16IGmurdzxvYbDd5ynxjnyrzLnieG96eTcAyaoj/wN/4/1FyyeA==", + "dev": true, + "dependencies": { + "@mdn/browser-compat-data": "^5.2.34" + } + }, "node_modules/asynciterator.prototype": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz", @@ -4969,9 +4986,9 @@ } }, "node_modules/browserslist": { - "version": "4.21.7", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.7.tgz", - "integrity": "sha512-BauCXrQ7I2ftSqd2mvKHGo85XR0u7Ru3C/Hxsy/0TkfCtjrmAbPdzLGasmoiBxplpDXlPvdjX9u7srIMfgasNA==", + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz", + "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==", "dev": true, "funding": [ { @@ -4988,10 +5005,10 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001489", - "electron-to-chromium": "^1.4.411", - "node-releases": "^2.0.12", - "update-browserslist-db": "^1.0.11" + "caniuse-lite": "^1.0.30001541", + "electron-to-chromium": "^1.4.535", + "node-releases": "^2.0.13", + "update-browserslist-db": "^1.0.13" }, "bin": { "browserslist": "cli.js" @@ -5083,9 +5100,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001495", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001495.tgz", - "integrity": "sha512-F6x5IEuigtUfU5ZMQK2jsy5JqUUlEFRVZq8bO2a+ysq5K7jD6PPc9YXZj78xDNS3uNchesp1Jw47YXEqr+Viyg==", + "version": "1.0.30001554", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001554.tgz", + "integrity": "sha512-A2E3U//MBwbJVzebddm1YfNp7Nud5Ip+IPn4BozBmn4KqVX7AvluoIDFWjsv5OkGnKUXQVmMSoMKLa3ScCblcQ==", "dev": true, "funding": [ { @@ -5937,9 +5954,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.422", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.422.tgz", - "integrity": "sha512-OQMid0IRbJv27BhlPiBK8CfGzjeq4ZCBSmpwNi1abyS8w17/BajOUu7hBI49ptDTBCz9NRFbORhWvt41dF7dwg==", + "version": "1.4.567", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.567.tgz", + "integrity": "sha512-8KR114CAYQ4/r5EIEsOmOMqQ9j0MRbJZR3aXD/KFA8RuKzyoUB4XrUCg+l8RUGqTVQgKNIgTpjaG8YHRPAbX2w==", "dev": true }, "node_modules/emittery": { @@ -6316,6 +6333,27 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-compat": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-compat/-/eslint-plugin-compat-4.2.0.tgz", + "integrity": "sha512-RDKSYD0maWy5r7zb5cWQS+uSPc26mgOzdORJ8hxILmWM7S/Ncwky7BcAtXVY5iRbKjBdHsWU8Yg7hfoZjtkv7w==", + "dev": true, + "dependencies": { + "@mdn/browser-compat-data": "^5.3.13", + "ast-metadata-inferer": "^0.8.0", + "browserslist": "^4.21.10", + "caniuse-lite": "^1.0.30001524", + "find-up": "^5.0.0", + "lodash.memoize": "^4.1.2", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=14.x" + }, + "peerDependencies": { + "eslint": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, "node_modules/eslint-plugin-deprecation": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-deprecation/-/eslint-plugin-deprecation-2.0.0.tgz", @@ -6381,6 +6419,15 @@ } } }, + "node_modules/eslint-plugin-prefer-arrow-functions": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/eslint-plugin-prefer-arrow-functions/-/eslint-plugin-prefer-arrow-functions-3.2.4.tgz", + "integrity": "sha512-HbPmlbO/iYQeVs2fuShNkGVJDfVfgSd84Vzxv+xlh+nIVoSsZvTj6yOqszw4mtG9JbiqMShVWqbVeoVsejE59w==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, "node_modules/eslint-plugin-prettier": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz", @@ -10391,9 +10438,9 @@ "dev": true }, "node_modules/node-releases": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.12.tgz", - "integrity": "sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==", + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", "dev": true }, "node_modules/normalize-package-data": { @@ -13041,9 +13088,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "dev": true, "funding": [ { diff --git a/packages/frontend/package.json b/packages/frontend/package.json index 5d4dc5930..e1fd2db8d 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -47,8 +47,10 @@ "babel-preset-react-app": "^10.0.1", "eslint": "^8.52.0", "eslint-config-prettier": "^9.0.0", + "eslint-plugin-compat": "^4.2.0", "eslint-plugin-deprecation": "^2.0.0", "eslint-plugin-jest": "^27.4.3", + "eslint-plugin-prefer-arrow-functions": "^3.2.4", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-react": "^7.33.2", "eslint-plugin-simple-import-sort": "^10.0.0", diff --git a/packages/frontend/webpack.config.js b/packages/frontend/webpack.config.js index 44cab71e0..e88bbabd4 100644 --- a/packages/frontend/webpack.config.js +++ b/packages/frontend/webpack.config.js @@ -6,7 +6,7 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin") const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin") const { SubresourceIntegrityPlugin } = require("webpack-subresource-integrity") -module.exports = function (env) { +module.exports = (env) => { const mode = process.env.NODE_ENV ?? (env.development ? "development" : "production")