Skip to content

Commit

Permalink
Merge pull request #13 from paritytech/yuri/linting
Browse files Browse the repository at this point in the history
Added linting to project
  • Loading branch information
mutantcornholio committed Jul 10, 2023
2 parents 33bf2e7 + a8386f7 commit f9319ef
Show file tree
Hide file tree
Showing 7 changed files with 2,037 additions and 13 deletions.
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

0 comments on commit f9319ef

Please sign in to comment.