Skip to content
Draft
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
8 changes: 8 additions & 0 deletions apollo.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Copyright (c) 2026-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/

module.exports = {
client: {
service: {
Expand Down
8 changes: 8 additions & 0 deletions babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Copyright (c) 2026-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/

module.exports = {
plugins: [
[
Expand Down
8 changes: 8 additions & 0 deletions codegen.local.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Copyright (c) 2026-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/

import type { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
Expand Down
8 changes: 8 additions & 0 deletions codegen.server.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* Copyright (c) 2026-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/

import type { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
Expand Down
16 changes: 8 additions & 8 deletions e2e/apiMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface ExtendedTestOptions {
*/
export const test = Ptest.extend<ExtendedTestOptions>({
harCheckpoint: [
async ({ context, page }, use) => {
async ({ context, page }, call) => {
let checkpointIndex = 0;

// Appending the checkpoint index to the request headers
Expand All @@ -41,21 +41,21 @@ export const test = Ptest.extend<ExtendedTestOptions>({
await page.setExtraHTTPHeaders(createCheckpoint(checkpointIndex));

// Appending the new checkpoint index to the request headers
await use(async () => {
await call(async () => {
checkpointIndex += 1;
await page.setExtraHTTPHeaders(createCheckpoint(checkpointIndex));
});
},
{ auto: true, scope: "test" },
],
waitGraphql: async ({ page }, use) => {
await use(async () => {
waitGraphql: async ({ page }, call) => {
await call(async () => {
if (process.env.RECORD_FIXTURES === "true") {
await page.waitForResponse("**/graphql-api/graphql");
}
});
},
page: async ({ page }, use, testInfo) => {
page: async ({ page }, call, testInfo) => {
// Creating the API mocking for the wanted API's
const mockdataFilename = getMockdataFilename(testInfo);
await page.routeFromHAR(mockdataFilename, {
Expand All @@ -65,12 +65,12 @@ export const test = Ptest.extend<ExtendedTestOptions>({
updateContent: "embed",
});

await use(page);
await call(page);

await page.close();
},
context: async ({ context }, use, testInfo) => {
await use(context);
context: async ({ context }, call, testInfo) => {
await call(context);
await context.close();

// Removing sensitive data from the HAR file after saving. Har files are saved on close.
Expand Down
27 changes: 15 additions & 12 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
// @ts-check

import graphqlPlugin from "@graphql-eslint/eslint-plugin";
import config from "eslint-config-ndla";
import tseslint from "typescript-eslint";
import tsParser from "@typescript-eslint/parser";

export default tseslint.config(
...config,
const config = [
{
ignores: ["**/graphqlTypes.ts", "**/schema.graphql"],
ignores: ["src/schema.graphql", "**/graphqlTypes.ts"],
},
{
files: ["**/*.graphql"],
rules: {
"header/header": "off",
files: ["src/**/*.{js,mjs,cjs,ts,jsx,tsx,mts,cts,mtsx,ctsx}"],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
},
},
{
files: ["**/*.{js,mjs,cjs,ts,jsx,tsx,mts,cts,mtsx,ctsx}"],
processor: graphqlPlugin.processor,
},
{
Expand All @@ -47,6 +47,9 @@ export default tseslint.config(
// TODO: Consider enabling these later
"@graphql-eslint/selection-set-depth": "off",
"@graphql-eslint/require-selections": "off",
"@graphql-eslint/naming-convention": "off",
},
},
);
];

export default config;
32 changes: 32 additions & 0 deletions oxlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (c) 2026-present, NDLA.
*
* This source code is licensed under the GPLv3 license found in the
* LICENSE file in the root directory of this source tree.
*
*/

import { baseConfig } from "@ndla/oxlint-config";
import { defineConfig } from "oxlint";

export default defineConfig({
extends: [baseConfig],
options: {
typeAware: true,
},
ignorePatterns: ["**/graphqlTypes.ts", "**/schema.graphql"],
overrides: [
{
files: ["**/*.graphql"],
rules: {
"notice/notice": "off",
},
},
{
files: ["**/*"],
rules: {
"typescript/unbound-method": "off",
},
},
],
});
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"test": "vitest --run",
"tdd": "vitest",
"lint": "yarn format-check && yarn lint-es",
"lint-es": "eslint --cache --cache-location '.eslintcache/' --max-warnings=0 src e2e",
"lint-es": "oxlint --deny-warnings && eslint --cache --cache-location '.eslintcache/' --max-warnings=0 src",
"format": "oxfmt",
"format-check": "oxfmt --check",
"start": "NODE_OPTIONS='--preserve-symlinks' concurrently 'yarn start:tsc' 'tsx src/server.ts'",
Expand Down Expand Up @@ -88,6 +88,7 @@
"slate": "^0.123.0",
"slate-dom": "^0.123.0",
"slate-history": "^0.113.1",
"slate-hyperscript": "^0.100.0",
"slate-react": "^0.123.0",
"source-map-support": "^0.5.21",
"winston": "^3.12.0"
Expand All @@ -100,6 +101,7 @@
"@graphql-codegen/typescript-operations": "^5.0.9",
"@graphql-eslint/eslint-plugin": "^4.4.0",
"@juggle/resize-observer": "^3.4.0",
"@ndla/oxlint-config": "^0.1.0",
"@ndla/preset-panda": "^0.0.75",
"@ndla/types-backend": "^1.0.106",
"@ndla/types-embed": "^5.0.21-alpha.0",
Expand All @@ -115,20 +117,21 @@
"@types/node": "^24.12.0",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@typescript-eslint/parser": "^8.57.2",
"@vitejs/plugin-react": "^5.1.4",
"babel-plugin-graphql-tag": "^3.3.0",
"concurrently": "^9.2.1",
"esbuild": "^0.27.3",
"eslint": "^9.39.4",
"eslint-config-ndla": "^6.0.15-alpha.0",
"jsdom": "^29.0.1",
"nock": "^14.0.11",
"oxfmt": "^0.36.0",
"oxlint": "^1.57.0",
"oxlint-tsgolint": "^0.17.3",
"postcss": "^8.5.8",
"postcss-preset-env": "^11.2.0",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
"typescript-eslint": "^8.56.1",
"vite": "^7.3.1",
"vitest": "^4.0.18"
},
Expand Down
4 changes: 3 additions & 1 deletion postcss.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import panda from "@pandacss/dev/postcss";
import postcssPresetEnv from "postcss-preset-env";

export default {
const config = {
plugins: [panda(), postcssPresetEnv()],
};

export default config;
2 changes: 1 addition & 1 deletion src/components/AlertsContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const AlertsProvider = ({ children }: Props) => {
const parsed = JSON.parse(closedAlerts);
if (Array.isArray(parsed) && parsed.every((id) => typeof id === "number")) return parsed;
return [];
} catch (e) {
} catch (_) {
return [];
}
}, [closedAlerts]);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Learningpath/components/ArticleStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const ArticleStep = ({
if (window.MathJax && typeof window.MathJax.typesetPromise === "function") {
try {
window.MathJax.typesetPromise();
} catch (err) {
} catch (_) {
// do nothing
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const CopyLearningPath = ({ learningpath }: Props) => {
} else {
onError();
}
} catch (err) {
} catch (_) {
onError();
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/MediaList/MediaList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const ItemText = ({ item }: { item: ItemType }) => {
return (
<Text textStyle="body.medium">
{`${item.label}: `}
{/* eslint-disable-next-line react/no-unknown-property */}
{/* oxlint-disable-next-line react/no-unknown-property */}
<span property={licenseMap[item.metaType]}>{item.description}</span>
</Text>
);
Expand Down
7 changes: 1 addition & 6 deletions src/components/license/LicenseBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ const StyledTabsRoot = styled(TabsRoot, {
},
});

function buildLicenseTabList(
article: GQLLicenseBox_ArticleFragment,
t: TFunction,
copyText?: string,
oembed?: string | undefined,
) {
function buildLicenseTabList(article: GQLLicenseBox_ArticleFragment, t: TFunction, copyText?: string, oembed?: string) {
const metaData = article.transformedContent?.metaData;
const tabs = [];
const articleTexts: TextItem[] = [
Expand Down
2 changes: 1 addition & 1 deletion src/containers/AboutPageV2/AboutPageLeaf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const AboutPageLeaf = ({ article: _article, crumbs }: Props) => {
if (window.MathJax && typeof window.MathJax.typeset === "function") {
try {
window.MathJax.typeset();
} catch (err) {
} catch (_) {
// do nothing
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/ArticlePage/ArticlePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ArticlePage = ({ resource, skipToContentId, loading }: Props) => {
if (window.MathJax && typeof window.MathJax.typesetPromise === "function") {
try {
window.MathJax.typesetPromise();
} catch (err) {
} catch (_) {
// do nothing
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/containers/Masthead/MastheadSearchForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { styled } from "@ndla/styled-system/jsx";
import { linkOverlay } from "@ndla/styled-system/patterns";
import { BadgesContainer, useComboboxTranslations } from "@ndla/ui";
import parse from "html-react-parser";
import { FormEvent, useEffect, useId, useMemo, useState } from "react";
import { SubmitEvent, useEffect, useId, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useLocation, useNavigate } from "react-router";
import { GQLMastheadSearchQuery, GQLMastheadSearchQueryVariables } from "../../graphqlTypes";
Expand Down Expand Up @@ -254,7 +254,7 @@ export const MastheadSearchForm = ({ root }: Props) => {
},
);

const onSearch = (evt?: FormEvent) => {
const onSearch = (evt?: SubmitEvent) => {
evt?.preventDefault();
const searchString = new URLSearchParams(
query?.length ? { query: encodeURIComponent(query) } : undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const EditLearningpathStepsPageContent = ({ learningpath }: Props) => {
onError();
}
}
} catch (err) {
} catch (_) {
onError();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from "@ndla/primitives";
import { SafeLinkButton } from "@ndla/safelink";
import { HStack, styled } from "@ndla/styled-system/jsx";
import { FormEvent, useContext, useEffect, useRef, useState } from "react";
import { SubmitEvent, useContext, useEffect, useRef, useState } from "react";
import { Controller, FormProvider, useForm, useFormContext } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { useNavigate, useOutletContext, useParams } from "react-router";
Expand Down Expand Up @@ -183,7 +183,7 @@ export const LearningpathStepForm = ({ step, language }: Props) => {
}
};

const onSubmit = (e: FormEvent<HTMLFormElement>) => {
const onSubmit = (e: SubmitEvent<HTMLFormElement>) => {
e.preventDefault();
handleSubmit(onSave)();
};
Expand Down
2 changes: 1 addition & 1 deletion src/containers/PlainArticlePage/PlainArticleContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const PlainArticleContainer = ({ article: propArticle, skipToContentId }:
if (window.MathJax && typeof window.MathJax.typesetPromise === "function") {
try {
window.MathJax.typesetPromise();
} catch (err) {
} catch (_) {
// do nothing
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/containers/SearchPage/SearchContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
} from "@ndla/primitives";
import { styled } from "@ndla/styled-system/jsx";
import { HomeBreadcrumb, usePaginationTranslations } from "@ndla/ui";
import { FormEvent, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
import { SubmitEvent, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { LanguageSelectorSelect } from "../../components/LanguageSelector/LanguageSelectorSelect";
import { SKIP_TO_CONTENT_ID } from "../../constants";
Expand Down Expand Up @@ -311,7 +311,7 @@ export const SearchContainer = ({ resourceTypes, resourceTypesLoading }: Props)
const data = searchQuery.data ?? searchQuery.previousData;

const handleSubmit = useCallback(
(e: FormEvent<HTMLFormElement>) => {
(e: SubmitEvent<HTMLFormElement>) => {
e.preventDefault();
setSearchParams({ query: encodeURIComponent(query) });
},
Expand Down
2 changes: 1 addition & 1 deletion src/lti/components/LtiDeepLinking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const LtiDeepLinking = ({ ltiData = {}, item }: Props) => {

useEffect(() => {
updatePostData();
}, [ltiData]); // eslint-disable-line react-hooks/exhaustive-deps
}, [ltiData]); // oxlint-disable-line react-hooks/exhaustive-deps

const updatePostData = async () => {
const data = await getLtiPostData(ltiData, item);
Expand Down
2 changes: 1 addition & 1 deletion src/server/authEndpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const isSafeRedirect = (url: string) => {
try {
const decodedUrl = decodeURIComponent(url).trim();
return decodedUrl.startsWith("/") && !decodedUrl.startsWith("//");
} catch (e) {
} catch (_) {
return false;
}
};
Expand Down
Loading
Loading