Skip to content

Commit

Permalink
Update NPM dependencies (#16716)
Browse files Browse the repository at this point in the history
Includes necessary updates for:
- types (eslint)
- ts formatting (prettier, single ts rule change)
- scss (dart sass deprecations)
  • Loading branch information
stwlam authored Oct 1, 2024
1 parent 3943cd7 commit 563a712
Show file tree
Hide file tree
Showing 159 changed files with 1,524 additions and 963 deletions.
89 changes: 0 additions & 89 deletions .eslintrc.json

This file was deleted.

7 changes: 4 additions & 3 deletions build/lib/foundry-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ export function getType(variable: unknown): string {
if ((variable as object).constructor.name === "Object") return "Object"; // simple objects

// Match prototype instances
const prototypes: [Function, string][] = [
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const prototypes: [new (...args: any[]) => object, string][] = [
[Array, "Array"],
[Set, "Set"],
[Map, "Map"],
Expand Down Expand Up @@ -290,7 +291,7 @@ function _arrayEquals(arr: unknown[], other: unknown): boolean {
const t1 = getType(v1);
if (t0 !== t1) return false;
if ((v0 as Maybe<{ equals?: unknown }>)?.equals instanceof Function)
return (v0 as { equals: Function }).equals(v1);
return (v0 as { equals: (arg: unknown) => boolean }).equals(v1);
if (t0 === "Object") return objectsEqual(v0 as object, v1);
return v0 === v1;
});
Expand Down Expand Up @@ -318,7 +319,7 @@ function diffObject(original: object, other: object, { inner = false, deletionKe

// If the prototype explicitly exposes an equality-testing method, use it
if ((v0 as { equals?: unknown }).equals instanceof Function) {
return [!(v0 as { equals: Function }).equals(v1), v1];
return [!(v0 as { equals: (arg: unknown) => boolean }).equals(v1), v1];
}
if (Array.isArray(v0)) {
return [!_arrayEquals(v0, v1), v1];
Expand Down
51 changes: 51 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// @ts-check

import eslint from "@eslint/js";
import jest from "eslint-plugin-jest";
import prettier from "eslint-plugin-prettier";
import globals from "globals";
import tseslint from "typescript-eslint";

export default [
{ files: ["**/*.ts"] },
{ ignores: ["**/dist/"] },
eslint.configs.recommended,
...tseslint.configs.recommended,
{
plugins: { jest, prettier },
languageOptions: {
globals: {
...globals.browser,
...jest.environments.globals.globals,
},
ecmaVersion: 2022,
sourceType: "module",
parserOptions: { project: "./tsconfig.json" },
},
rules: {
eqeqeq: "error",
"prettier/prettier": "error",
"no-console": "off",
"no-plusplus": ["error", { allowForLoopAfterthoughts: true }],
"no-unused-expressions": ["error", { allowShortCircuit: true }],
"spaced-comment": ["error", "always", { markers: ["/"] }],
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "error",
"@typescript-eslint/prefer-namespace-keyword": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-object-type": ["error", { allowInterfaces: "with-single-extends" }],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unsafe-declaration-merging": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/array-type": ["error", { default: "array" }],
},
},
{
files: ["tests/**/*"],
rules: { "global-require": "off" },
},
];
7 changes: 7 additions & 0 deletions eslint.json.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// @ts-check
import json from "eslint-plugin-json";

export default [
{ files: ["static/lang/*.json", "static/system.json", "static/template.json"] },
json.configs["recommended"],
];
Loading

0 comments on commit 563a712

Please sign in to comment.