Skip to content
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
136 changes: 136 additions & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import { defineConfig } from "eslint/config";
import eslint from "@eslint/js";
import tseslint, { parser, plugin } from "typescript-eslint";
import stylistic from "@stylistic/eslint-plugin";

Check failure on line 4 in eslint.config.ts

View workflow job for this annotation

GitHub Actions / build (20.19.0)

Cannot find module '@stylistic/eslint-plugin' or its corresponding type declarations.

export default defineConfig(
{
files: ["**/*.ts"],
languageOptions: {
ecmaVersion: 15,
parser: parser,
parserOptions: {
ecmaVersion: 15,
sourceType: "module",
project: true
}
},
plugins: {
"@typescript-eslint": plugin,
"@stylistic": stylistic
},
extends: [
eslint.configs.recommended,
tseslint.configs.recommended,
tseslint.configs.recommendedTypeChecked
],
rules: {
"camelcase": ["warn", {
"properties": "never",
"ignoreImports": true
}],
"curly": ["error", "all"],
"default-case": 1,
"eqeqeq": ["error", "smart"],
"no-unreachable": 2,
"no-useless-escape": 0,
"sort-imports": ["warn", {
"ignoreCase": false,
"ignoreDeclarationSort": true
}],
"@stylistic/arrow-parens": ["warn", "always"],
"@stylistic/brace-style": ["warn", "1tbs"],
"@stylistic/comma-dangle": ["error", "never"],
"@stylistic/comma-spacing": ["warn", {
"after": true,
"before": false
}],
"@stylistic/comma-style": ["warn", "last"],
"@stylistic/eol-last": ["warn", "always"],
"@stylistic/indent": ["warn", 4, {
"SwitchCase": 1
}],
"@stylistic/key-spacing": ["warn", {
"mode": "strict"
}],
"@stylistic/keyword-spacing": ["warn", {
"after": true,
"before": true
}],
"@stylistic/lines-between-class-members": ["warn", "always"],
"@stylistic/no-extra-semi": 2,
"@stylistic/no-multi-spaces": 1,
"@stylistic/no-multiple-empty-lines": ["warn", {
"max": 1
}],
"@stylistic/no-tabs": 1,
"@stylistic/no-trailing-spaces": 1,
"@stylistic/object-curly-spacing": ["error", "always", {
"arraysInObjects": true,
"objectsInObjects": true
}],
"@stylistic/quotes": ["warn", "double", {
"avoidEscape": false
}],
"@stylistic/semi": 2,
"@stylistic/semi-style": ["warn", "last"],
"@stylistic/member-delimiter-style": ["warn", {
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
},
"multilineDetection": "brackets"
}],
"@typescript-eslint/naming-convention": ["warn",
{
"selector": "default",
"format": ["camelCase"]
},
{
"selector": "classProperty",
"modifiers": ["private"],
"format": ["camelCase"],
"leadingUnderscore": "require"
},
{
"selector": "property",
"format": null
},
{
"selector": "import",
"format": ["camelCase", "PascalCase"]
},
{
"selector": "memberLike",
"format": ["camelCase"]
},
{
"selector": "variableLike",
"format": ["camelCase"]
},
{
"selector": "typeLike",
"format": ["PascalCase"]
}
],
"@typescript-eslint/explicit-function-return-type": ["warn", {
"allowExpressions": true
}],
"@typescript-eslint/no-unnecessary-condition": 2,
"@typescript-eslint/no-unused-expressions": 0,
"@typescript-eslint/no-unused-vars": 2,
"@typescript-eslint/no-require-imports": 2,
"@typescript-eslint/no-var-requires": 1
}
},
{
ignores: [
"node_modules",
"dist"
]
}
);
42 changes: 21 additions & 21 deletions src/class/issuesClose.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Context from "../index";
import { Context } from "../index.js";

/**
* @class
Expand All @@ -11,14 +11,14 @@ export default class IssuesClose {
* @private
* @type Context<"issues.closed">
*/
private context: Context<"issues.closed">;
private _context: Context<"issues.closed">;

/**
* @constructor
* @param {Context<"issues.closed">} context
*/
constructor(context: Context<"issues.closed">) {
this.context = context;
this._context = context;
}

/**
Expand All @@ -27,18 +27,18 @@ export default class IssuesClose {
* @returns {Promise<void>}
*/
public async closed(): Promise<void> {
const issueClosed = this.context.issue({
body: `Issue closed by @${this.context.payload.sender.login}.`
const issueClosed = this._context.issue({
body: `Issue closed by @${this._context.payload.sender.login}.`
});
console.log("Issues closed");
await this.context.octokit.issues.addLabels(
this.context.issue({
await this._context.octokit.issues.addLabels(
this._context.issue({
labels: ["Closed"]
})
);
await this.context.octokit.issues.createComment(issueClosed);
await this.context.octokit.issues.removeLabel(
this.context.issue({
await this._context.octokit.issues.createComment(issueClosed);
await this._context.octokit.issues.removeLabel(
this._context.issue({
name: "Pending"
})
);
Expand All @@ -50,25 +50,25 @@ export default class IssuesClose {
* @returns {Promise<void>}
*/
public async invalid(): Promise<void> {
const issueClosed = this.context.issue({
body: `Issue closed as invalid by @${this.context.payload.sender.login}.`
const issueClosed = this._context.issue({
body: `Issue closed as invalid by @${this._context.payload.sender.login}.`
});
console.log("Issues closed");
await this.context.octokit.issues.addLabels(
this.context.issue({
await this._context.octokit.issues.addLabels(
this._context.issue({
labels: ["Closed", "Invalid"]
})
);
await this.context.octokit.issues.createComment(issueClosed);
await this.context.octokit.issues.removeLabel(
this.context.issue({
await this._context.octokit.issues.createComment(issueClosed);
await this._context.octokit.issues.removeLabel(
this._context.issue({
name: "Pending"
})
);
await this.context.octokit.issues.lock({
owner: this.context.payload.repository.owner.login,
repo: this.context.payload.repository.name,
issue_number: this.context.payload.issue.number,
await this._context.octokit.issues.lock({
owner: this._context.payload.repository.owner.login,
repo: this._context.payload.repository.name,
issue_number: this._context.payload.issue.number,
lock_reason: "off-topic"
});
}
Expand Down
Loading
Loading