Skip to content

Commit

Permalink
Update eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
gausie committed Sep 30, 2024
1 parent 305a845 commit f44a746
Show file tree
Hide file tree
Showing 6 changed files with 300 additions and 308 deletions.
2 changes: 1 addition & 1 deletion packages/excavator-projects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
},
"prettier": "excavator-prettier-config",
"dependencies": {
"kolmafia": "^5.28068.0"
"kolmafia": "^5.28070.0"
}
}
45 changes: 0 additions & 45 deletions packages/excavator-script/.eslintrc.json

This file was deleted.

57 changes: 57 additions & 0 deletions packages/excavator-script/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// @ts-check
import eslint from "@eslint/js";
import prettier from "eslint-config-prettier";
import * as libram from "eslint-plugin-libram";
import tseslint from "typescript-eslint";

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
prettier,
{
plugins: { libram },
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ["*.mjs", "*.js"],
},
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"block-scoped-var": "error",
curly: ["error", "multi-line"],
"eol-last": "error",
eqeqeq: "error",
"no-trailing-spaces": "error",
"no-var": "error",
"prefer-arrow-callback": "error",
"prefer-const": "error",
"prefer-template": "error",
"sort-imports": [
"error",
{
ignoreCase: true,
ignoreDeclarationSort: true,
},
],
"spaced-comment": "error",

// This one needs a fix because TS's rules are different?
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-non-null-assertion": "error",

// eslint-plugin-libram
"libram/verify-constants": "error",
"no-restricted-syntax": [
"error",
{
selector:
"CallExpression[callee.property.name='reduce'][arguments.length<2]",
message: "Provide initialValue to .reduce().",
},
],
},
},
);
11 changes: 6 additions & 5 deletions packages/excavator-script/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"core-js": "^3.38.1",
"kolmafia": "^5.28068.0",
"kolmafia": "^5.28070.0",
"libram": "^0.9.10"
},
"devDependencies": {
Expand All @@ -23,20 +23,21 @@
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/preset-env": "^7.25.4",
"@babel/preset-typescript": "^7.24.7",
"@eslint/js": "^9.11.1",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.7.4",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"esbuild": "^0.24.0",
"esbuild-plugin-babel": "^0.2.3",
"eslint": "^8.57.1",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-libram": "^0.4.13",
"eslint-plugin-prettier": "^5.2.1",
"excavator-prettier-config": "^0.0.0",
"excavator-projects": "^0.0.0",
"prettier": "^3.3.3",
"typescript": "^5.6.2"
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0"
},
"prettier": "excavator-prettier-config"
}
4 changes: 3 additions & 1 deletion packages/excavator-script/src/excavator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ function main(event: Event, meta: string, page: string) {
({ hooks, since = 0, completed }) =>
!completed && event in hooks && since <= getRevision(),
)
.map(({ name, hooks }) => [name, hooks[event]!(meta, page)] as const)
.map(
({ name, hooks }) => [name, hooks[event]?.(meta, page) ?? null] as const,
)
.filter(tupleNotNull)
.forEach(([name, data]) => {
// Projects are permitted to send a single or multiple data points at a time
Expand Down
Loading

0 comments on commit f44a746

Please sign in to comment.