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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ dist-ssr
# code-generated files
packages/lib/src/clients/backend
apps/admin/src/clients/admin
.oxlint-plugins

268 changes: 268 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,268 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": [
"unicorn",
"typescript",
"react"
],
"options": {
"typeAware": true
},
"categories": {
"correctness": "off"
},
"env": {
"builtin": true,
"browser": true
},
"ignorePatterns": [
"**/dist/**",
"packages/lib/src/clients/**",
"apps/admin/src/clients/admin/**",
],
"jsPlugins": [
{
"name": "anti-slop",
"specifier": "./.oxlint-plugins/anti-slop/index.ts"
}
],
"rules": {
"no-unexpected-multiline": "error",
"constructor-super": "error",
"for-direction": "error",
"getter-return": "error",
"no-async-promise-executor": "error",
"no-case-declarations": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-binary-expression": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-dupe-class-members": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-empty-static-block": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-import-assign": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-new-native-nonconstructor": "error",
"no-nonoctal-decimal-escape": "error",
"no-obj-calls": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-setter-return": "error",
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
"no-unassigned-vars": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-labels": "error",
"no-unused-private-class-members": "error",
"no-unused-vars": "error",
"no-useless-backreference": "error",
"no-useless-catch": "error",
"no-useless-escape": "error",
"no-with": "error",
"preserve-caught-error": "error",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
"no-array-constructor": "error",
"no-unused-expressions": "error",
"array-callback-return": "error",
"no-await-in-loop": "error",
"no-constructor-return": "error",
"no-inner-declarations": "error",
"no-promise-executor-return": "error",
"no-self-compare": "error",
"no-template-curly-in-string": "error",
"no-use-before-define": "error",
"arrow-body-style": "error",
"block-scoped-var": "error",
"default-case": "error",
"default-case-last": "error",
"default-param-last": "error",
"eqeqeq": "error",
"func-name-matching": "error",
"func-style": [
"error",
"declaration"
],
"init-declarations": [
"error",
"always"
],
"no-caller": "error",
"no-else-return": "error",
"no-label-var": "error",
"no-lone-blocks": "error",
"no-lonely-if": "error",
"no-loop-func": "error",
"no-return-assign": "error",
"no-sequences": "error",
"no-throw-literal": "error",
"no-unneeded-ternary": "error",
"no-useless-rename": "error",
"no-useless-return": "error",
"no-var": "error",
"prefer-const": "error",
"require-await": "error",
"typescript/ban-ts-comment": "error",
"typescript/no-duplicate-enum-values": "error",
"typescript/no-empty-object-type": "error",
"typescript/no-explicit-any": "error",
"typescript/no-extra-non-null-assertion": "error",
"typescript/no-misused-new": "error",
"typescript/no-namespace": "error",
"typescript/no-non-null-asserted-optional-chain": "error",
"typescript/no-require-imports": "error",
"typescript/no-this-alias": "error",
"typescript/no-unnecessary-type-constraint": "error",
"typescript/no-unsafe-declaration-merging": "error",
"typescript/no-unsafe-function-type": "error",
"typescript/no-wrapper-object-types": "error",
"typescript/prefer-as-const": "error",
"typescript/prefer-namespace-keyword": "error",
"typescript/triple-slash-reference": "error",
"typescript/array-type": "error",
"typescript/await-thenable": "error",
"typescript/no-confusing-void-expression": [
"error",
{
"ignoreArrowShorthand": true
}
],
"typescript/no-floating-promises": "error",
"typescript/no-misused-promises": [
"error",
{
"checksVoidReturn": {
"attributes": false
}
}
],
"typescript/no-misused-spread": "error",
"typescript/no-unnecessary-condition": "error",
"typescript/no-unnecessary-type-assertion": "error",
"typescript/only-throw-error": "error",
"typescript/restrict-template-expressions": [
"error",
{
"allowNumber": true,
"allowBoolean": true
}
],
"typescript/switch-exhaustiveness-check": "error",
"no-undef": "error",
"no-useless-assignment": "error",
"no-unreachable-loop": "error",
"id-match": [
"error",
"^_*(?:[A-Z][A-Z0-9_]*|[A-Za-z$][A-Za-z0-9$]*)_*$|^_+$",
{
"properties": false,
"classFields": false,
"ignoreDestructuring": false,
"onlyDeclarations": true
}
],
"anti-slop/no-chained-type-assertions": "error",
"anti-slop/no-conditional-empty-object-spread": "error",
"anti-slop/no-known-value-widening": "error",
"anti-slop/no-module-mocking": "error",
"anti-slop/no-object-parameters": "error",
"anti-slop/no-reflect-apply": "error",
"anti-slop/no-reflect-get": "error",
"anti-slop/no-runtime-typeof": "error",
"anti-slop/no-shape-in-symbol-names": "error",
"anti-slop/no-unknown-parameters": "error",
"anti-slop/no-unknown-returns": "error",
"anti-slop/no-unknown-type-aliases": "error",
"anti-slop/no-unsafe-dictionary-type": "error",
"anti-slop/no-widen-then-assert": "error",
"anti-slop/require-safety-comment-for-type-assertion": "error",
"react/rules-of-hooks": "error",
"react/exhaustive-deps": "error",
"react/jsx-key": "error",
"react/jsx-no-duplicate-props": "error",
"react/no-unstable-nested-components": "error",
"react/jsx-no-target-blank": "error",
"react/void-dom-elements-no-children": "error",
"unicorn/error-message": "error",
"unicorn/no-abusive-eslint-disable": "error",
"unicorn/no-instanceof-builtins": "error",
"unicorn/no-invalid-remove-event-listener": "error",
"unicorn/no-thenable": "error",
"unicorn/no-useless-fallback-in-spread": "error",
"unicorn/no-useless-spread": "error",
"unicorn/prefer-node-protocol": "error",
"unicorn/throw-new-error": "error"
},
"overrides": [
{
"files": [
"**/*.ts",
"**/*.tsx",
"**/*.mts",
"**/*.cts"
],
"rules": {
"constructor-super": "off",
"getter-return": "off",
"no-class-assign": "off",
"no-const-assign": "off",
"no-dupe-class-members": "off",
"no-dupe-keys": "off",
"no-func-assign": "off",
"no-import-assign": "off",
"no-new-native-nonconstructor": "off",
"no-obj-calls": "off",
"no-redeclare": "off",
"no-setter-return": "off",
"no-this-before-super": "off",
"no-unreachable": "off",
"no-unsafe-negation": "off",
"no-with": "off",
"prefer-rest-params": "error",
"prefer-spread": "error"
}
},
{
"files": [
"configs/**"
],
"globals": {
"window": "writable"
}
},
{
"files": [
"scripts/**",
"server.mjs"
],
"env": {
"node": true
}
}
]
}
2 changes: 1 addition & 1 deletion apps/admin/src/components/AuthNavControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function AuthNavControl(): ReactElement {
});
} finally {
clearAuthToken();
navigate("/login");
void navigate("/login");
setLoggingOut(false);
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/admin/src/components/ui/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ interface BadgeProps {
type?: BadgeType;
}

const typeClasses: Record<BadgeType, string> = {
const typeClasses = {
info: "bg-surface-2 border-2 border-border text-primary",
success: "bg-success/20 border-2 border-success/60 text-primary",
warning: "bg-warning/20 border-2 border-warning/60 text-primary",
};
} satisfies Record<BadgeType, string>;

export function Badge({
children,
Expand Down
1 change: 1 addition & 0 deletions apps/admin/src/components/ui/MultiSelectFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export function MultiSelectFilter({
function handlePointerDown(event: MouseEvent): void {
if (
containerRef.current &&
// SAFETY: `contains` expects a DOM Node; event targets inside the document are Nodes.
!containerRef.current.contains(event.target as Node)
) {
setOpen(false);
Expand Down
12 changes: 6 additions & 6 deletions apps/admin/src/components/ui/ObjectSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ export function ObjectSummary({
name: ReactNode;
layout?: "rows" | "columnar";
}): ReactElement {
const equatorial = catalogs?.coordinates?.equatorial;
const redshift = catalogs?.redshift;
const nature = catalogs?.nature;
const raUnit = schema.units.coordinates?.equatorial?.ra || "deg";
const eRaUnit = schema.units.coordinates?.equatorial?.e_ra || raUnit;
const eDecUnit = schema.units.coordinates?.equatorial?.e_dec || raUnit;
const equatorial = catalogs.coordinates?.equatorial;
const redshift = catalogs.redshift;
const nature = catalogs.nature;
const raUnit = schema.units.coordinates.equatorial.ra || "deg";
const eRaUnit = schema.units.coordinates.equatorial.e_ra || raUnit;
const eDecUnit = schema.units.coordinates.equatorial.e_dec || raUnit;

const nameField = (
<>
Expand Down
11 changes: 5 additions & 6 deletions apps/admin/src/origins.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
import { sameEnvWebOrigin } from "@hyperleda/lib/origins";

export function publicObjectUrl(pgc: number): {
interface ExternalLinkTarget {
href: string;
external: boolean;
} {
}

export function publicObjectUrl(pgc: number): ExternalLinkTarget {
return {
href: `${sameEnvWebOrigin()}/object/${pgc}`,
external: true,
};
}

export function adminTableUrl(tableName: string): {
href: string;
external: boolean;
} {
export function adminTableUrl(tableName: string): ExternalLinkTarget {
return {
href: `/table/${encodeURIComponent(tableName)}`,
external: false,
Expand Down
Loading
Loading