Skip to content

Commit

Permalink
Merge pull request #1174 from skaut/prefer-arrow
Browse files Browse the repository at this point in the history
Prefering arrow functions & checking browser compatibility
  • Loading branch information
marekdedic authored Oct 26, 2023
2 parents e4e2f20 + a75366a commit 79e1557
Show file tree
Hide file tree
Showing 10 changed files with 115 additions and 26 deletions.
13 changes: 11 additions & 2 deletions packages/collector/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"plugins": [
"deprecation",
"jest",
"prefer-arrow-functions",
"simple-import-sort",
"@typescript-eslint"
],
Expand All @@ -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",
Expand Down
17 changes: 17 additions & 0 deletions packages/collector/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/collector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/collector/src/getProjectInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function getProjectInfo(project: Project): Promise<ProjectInfo> {
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;
Expand Down
2 changes: 1 addition & 1 deletion packages/collector/src/getProjectIssues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => ({
Expand Down
2 changes: 1 addition & 1 deletion packages/collector/src/getProjectVisibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { octokit } from "./octokit";
export async function getProjectVisibility(project: Project): Promise<boolean> {
const rawResponse = await octokit.rest.repos
.get({ ...project })
.catch(function (e): never {
.catch((e): never => {
throw new VisibilityError(String(e));
});
return !rawResponse.data.private;
Expand Down
15 changes: 14 additions & 1 deletion packages/frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
"node": false
},
"plugins": [
"compat",
"deprecation",
"jest",
"prefer-arrow-functions",
"simple-import-sort",
"@typescript-eslint"
],
Expand All @@ -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" }],
Expand Down
85 changes: 66 additions & 19 deletions packages/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 79e1557

Please sign in to comment.