Skip to content

Commit df42611

Browse files
authored
Update to Node 18 (#298)
Update most dependencies, including discord.js and ESLint Also minor fixes to the GitHub workflow
1 parent a8d29da commit df42611

20 files changed

+1196
-3387
lines changed

.eslintignore

-4
This file was deleted.

.eslintrc.json

-54
This file was deleted.

.github/workflows/pull-request-build.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
node-version: [16.x]
14+
node-version: [18.x]
1515

1616
steps:
1717
- name: Checkout repository
1818
uses: actions/checkout@v3
1919

20-
- name: Setup Node.js ${{ matrix.node-version }}
20+
- name: Set up Node.js ${{ matrix.node-version }}
2121
uses: actions/setup-node@v3
2222
with:
2323
node-version: ${{ matrix.node-version }}
2424

25-
- uses: actions/cache@v3
25+
- name: Set up cache for NPM modules
26+
uses: actions/cache@v3
2627
with:
2728
path: ~/.npm
2829
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

.github/workflows/push-build-deploy.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [16.x]
19+
node-version: [18.x]
2020

2121
steps:
2222
- name: Checkout repository
@@ -60,8 +60,8 @@ jobs:
6060
artifact_paths: |
6161
bin
6262
node_modules
63-
config/default.yml
64-
config/main.yml
63+
config/default.*
64+
config/main.*
6565
*.sh
6666
artifact_destination: /home/mojiradiscordbot/mojira-discord-bot
6767
script: |

eslint.config.mjs

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
2+
import stylistic from "@stylistic/eslint-plugin";
3+
import globals from "globals";
4+
import tsParser from "@typescript-eslint/parser";
5+
import path from "node:path";
6+
import { fileURLToPath } from "node:url";
7+
import js from "@eslint/js";
8+
import { FlatCompat } from "@eslint/eslintrc";
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = path.dirname(__filename);
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all
16+
});
17+
18+
export default [{
19+
ignores: [
20+
// don't ever lint node_modules
21+
"**/node_modules",
22+
// don't lint build output (make sure it's set to your correct build folder name)
23+
"**/bin"
24+
],
25+
}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"), {
26+
files: ["**/*.ts"],
27+
28+
plugins: {
29+
"@typescript-eslint": typescriptEslint,
30+
"@stylistic": stylistic,
31+
},
32+
33+
languageOptions: {
34+
globals: {
35+
...globals.node,
36+
},
37+
38+
parser: tsParser,
39+
ecmaVersion: 5,
40+
sourceType: "module",
41+
42+
parserOptions: {
43+
project: "tsconfig.json",
44+
},
45+
},
46+
47+
rules: {
48+
"brace-style": ["warn", "1tbs", {
49+
allowSingleLine: true,
50+
}],
51+
52+
"comma-dangle": ["warn", "always-multiline"],
53+
"comma-spacing": "warn",
54+
"comma-style": "warn",
55+
curly: ["warn", "multi-line", "consistent"],
56+
"dot-location": ["warn", "property"],
57+
"eol-last": "warn",
58+
"@stylistic/indent": ["warn", "tab"],
59+
"keyword-spacing": ["warn"],
60+
61+
"max-nested-callbacks": ["warn", {
62+
max: 4,
63+
}],
64+
65+
"max-statements-per-line": ["warn", {
66+
max: 2,
67+
}],
68+
69+
"no-empty-function": "warn",
70+
"no-floating-decimal": "warn",
71+
"@typescript-eslint/no-floating-promises": "error",
72+
"no-inline-comments": "warn",
73+
"no-lonely-if": "warn",
74+
"no-multi-spaces": "warn",
75+
76+
"no-multiple-empty-lines": ["warn", {
77+
max: 2,
78+
maxEOF: 1,
79+
maxBOF: 0,
80+
}],
81+
82+
"no-shadow": "off",
83+
84+
"@typescript-eslint/no-shadow": ["error", {
85+
allow: ["err", "resolve", "reject"],
86+
}],
87+
88+
"no-trailing-spaces": ["warn"],
89+
"no-var": "error",
90+
"object-curly-spacing": ["warn", "always"],
91+
"prefer-const": "error",
92+
quotes: ["warn", "single"],
93+
"@stylistic/semi": ["warn"],
94+
"space-before-blocks": "warn",
95+
96+
"space-before-function-paren": ["warn", {
97+
anonymous: "never",
98+
named: "never",
99+
asyncArrow: "always",
100+
}],
101+
102+
"space-in-parens": ["warn", "always", {
103+
exceptions: ["empty"],
104+
}],
105+
106+
"space-infix-ops": "warn",
107+
"space-unary-ops": "warn",
108+
"spaced-comment": "warn",
109+
"template-curly-spacing": ["warn", "always"],
110+
111+
yoda: ["error", "never", {
112+
exceptRange: true,
113+
}],
114+
},
115+
}];

0 commit comments

Comments
 (0)