Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added linting to project #13

Merged
merged 1 commit into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
.git
10 changes: 10 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { getConfiguration, getTypescriptOverride } = require("@eng-automation/js-style/src/eslint/configuration");

const tsConfParams = { rootDir: __dirname };

const conf = getConfiguration({ typescript: tsConfParams });

const tsConfOverride = getTypescriptOverride(tsConfParams);
conf.overrides.push(tsConfOverride);

module.exports = conf;
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
.git
1 change: 1 addition & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@eng-automation/js-style/src/prettier/configuration")
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"start": "node dist",
"build": "ncc build --license LICENSE",
"test": "echo \"No tests yet\"",
"lint": "echo \"No linting yet\""
"fix": "eslint --fix 'src/**/*'",
"lint": "eslint 'src/**/*'"
},
"repository": {
"type": "git",
Expand All @@ -20,6 +21,7 @@
},
"homepage": "https://github.com/paritytech/review-bot#readme",
"devDependencies": {
"@eng-automation/js-style": "^2.1.0",
"@vercel/ncc": "^0.36.1",
"typescript": "^5.1.6"
},
Expand Down
22 changes: 11 additions & 11 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@ import { context } from "@actions/github";
import { Context } from "@actions/github/lib/context";

const getRepo = (ctx: Context) => {
let repo = getInput("repo", { required: false });
if (!repo) {
repo = ctx.repo.repo;
}
let repo = getInput("repo", { required: false });
if (!repo) {
repo = ctx.repo.repo;
}

let owner = getInput("owner", { required: false });
if (!owner) {
owner = ctx.repo.owner;
}
let owner = getInput("owner", { required: false });
if (!owner) {
owner = ctx.repo.owner;
}

return { repo, owner };
}
return { repo, owner };
};

const repo = getRepo(context);

setOutput("repo", `${repo.owner}/${repo.repo}`);

if (!context.payload.pull_request) {
throw new Error("No pull request event");
throw new Error("No pull request event");
}

debug("Got payload:" + JSON.stringify(context.payload.pull_request));
Expand Down
Loading