chore: update Knip to v5 (#56244)

This commit is contained in:
Lars Kappert
2024-09-26 13:12:00 +02:00
committed by GitHub
parent c39208360c
commit d32e57813e
30 changed files with 12573 additions and 14053 deletions
-2
View File
@@ -80,11 +80,9 @@
"@babel/cli": "7.17.10", "@babel/cli": "7.17.10",
"@babel/core": "7.18.0", "@babel/core": "7.18.0",
"@babel/node": "7.17.10", "@babel/node": "7.17.10",
"@babel/plugin-proposal-class-properties": "7.17.12",
"@babel/plugin-proposal-object-rest-spread": "7.18.0", "@babel/plugin-proposal-object-rest-spread": "7.18.0",
"@babel/plugin-proposal-optional-chaining": "7.17.12", "@babel/plugin-proposal-optional-chaining": "7.17.12",
"@babel/preset-env": "7.18.0", "@babel/preset-env": "7.18.0",
"@babel/register": "7.17.7",
"loopback-component-explorer": "6.4.0", "loopback-component-explorer": "6.4.0",
"nodemon": "2.0.16" "nodemon": "2.0.16"
} }
-5
View File
@@ -215,11 +215,6 @@ const completedExamChallenge = {
completedDate: expect.any(Number) completedDate: expect.any(Number)
}; };
export const completedExamChallengeZeroCorrect = {
...completedExamChallenge,
examResults: mockResultsZeroCorrect
};
export const completedExamChallengeOneCorrect = { export const completedExamChallengeOneCorrect = {
...completedExamChallenge, ...completedExamChallenge,
examResults: mockResultsOneCorrect examResults: mockResultsOneCorrect
+1 -1
View File
@@ -32,7 +32,7 @@ export const getCsrfToken = (setCookies: string[]): string | undefined => {
return csrfToken; return csrfToken;
}; };
export const ORIGIN = 'https://www.freecodecamp.org'; const ORIGIN = 'https://www.freecodecamp.org';
export const getCookies = (setCookies: string[]): string => { export const getCookies = (setCookies: string[]): string => {
for (const cookie of setCookies) { for (const cookie of setCookies) {
+1 -1
View File
@@ -51,7 +51,7 @@ import {
} from './utils/env'; } from './utils/env';
import { isObjectID } from './utils/validation'; import { isObjectID } from './utils/validation';
export type FastifyInstanceWithTypeProvider = FastifyInstance< type FastifyInstanceWithTypeProvider = FastifyInstance<
RawServerDefault, RawServerDefault,
RawRequestDefaultExpression, RawRequestDefaultExpression,
RawReplyDefaultExpression, RawReplyDefaultExpression,
-2
View File
@@ -48,7 +48,6 @@ assert.ok(isAllowedProvider(process.env.EMAIL_PROVIDER));
assert.ok(process.env.AUTH0_CLIENT_ID); assert.ok(process.env.AUTH0_CLIENT_ID);
assert.ok(process.env.AUTH0_CLIENT_SECRET); assert.ok(process.env.AUTH0_CLIENT_SECRET);
assert.ok(process.env.AUTH0_DOMAIN); assert.ok(process.env.AUTH0_DOMAIN);
assert.ok(process.env.AUTH0_AUDIENCE);
assert.ok(process.env.API_LOCATION); assert.ok(process.env.API_LOCATION);
assert.ok(process.env.FCC_ENABLE_SWAGGER_UI); assert.ok(process.env.FCC_ENABLE_SWAGGER_UI);
assert.ok(process.env.FCC_ENABLE_DEV_LOGIN_MODE); assert.ok(process.env.FCC_ENABLE_DEV_LOGIN_MODE);
@@ -118,7 +117,6 @@ export const MONGOHQ_URL =
export const FREECODECAMP_NODE_ENV = process.env.FREECODECAMP_NODE_ENV; export const FREECODECAMP_NODE_ENV = process.env.FREECODECAMP_NODE_ENV;
export const AUTH0_CLIENT_ID = process.env.AUTH0_CLIENT_ID; export const AUTH0_CLIENT_ID = process.env.AUTH0_CLIENT_ID;
export const AUTH0_DOMAIN = process.env.AUTH0_DOMAIN; export const AUTH0_DOMAIN = process.env.AUTH0_DOMAIN;
export const AUTH0_AUDIENCE = process.env.AUTH0_AUDIENCE;
export const AUTH0_CLIENT_SECRET = process.env.AUTH0_CLIENT_SECRET; export const AUTH0_CLIENT_SECRET = process.env.AUTH0_CLIENT_SECRET;
export const PORT = process.env.PORT || '3000'; export const PORT = process.env.PORT || '3000';
export const HOST = process.env.HOST || 'localhost'; export const HOST = process.env.HOST || 'localhost';
+2 -2
View File
@@ -4,7 +4,7 @@ export interface Answer {
} }
// types for a generated exam // types for a generated exam
export interface GeneratedQuestion { interface GeneratedQuestion {
id: string; id: string;
question: string; question: string;
answers: Answer[]; answers: Answer[];
@@ -13,7 +13,7 @@ export interface GeneratedQuestion {
export type GeneratedExam = GeneratedQuestion[]; export type GeneratedExam = GeneratedQuestion[];
// types for a user completed exam (from client) // types for a user completed exam (from client)
export interface UserQuestion { interface UserQuestion {
id: string; id: string;
question: string; question: string;
answer: Answer; answer: Answer;
+1 -1
View File
@@ -24,7 +24,7 @@ function shuffleArray<T>(arr: T[]): T[] {
* @param arr An array. * @param arr An array.
* @returns The array without objects that have deprecated: true. * @returns The array without objects that have deprecated: true.
*/ */
export function filterDeprecated<T extends { deprecated: boolean | null }>( function filterDeprecated<T extends { deprecated: boolean | null }>(
arr: T[] arr: T[]
): T[] { ): T[] {
return arr.filter(i => !i.deprecated); return arr.filter(i => !i.deprecated);
+2 -25
View File
@@ -41,7 +41,7 @@
"@babel/plugin-transform-runtime": "^7.19.6", "@babel/plugin-transform-runtime": "^7.19.6",
"@babel/preset-env": "7.23.7", "@babel/preset-env": "7.23.7",
"@babel/preset-react": "7.23.3", "@babel/preset-react": "7.23.3",
"@babel/runtime": "^7.20.13", "@babel/preset-typescript": "7.23.3",
"@babel/standalone": "7.23.7", "@babel/standalone": "7.23.7",
"@fortawesome/fontawesome-svg-core": "6.4.2", "@fortawesome/fontawesome-svg-core": "6.4.2",
"@fortawesome/free-brands-svg-icons": "6.4.2", "@fortawesome/free-brands-svg-icons": "6.4.2",
@@ -49,7 +49,6 @@
"@fortawesome/react-fontawesome": "0.2.0", "@fortawesome/react-fontawesome": "0.2.0",
"@freecodecamp/loop-protect": "3.0.0", "@freecodecamp/loop-protect": "3.0.0",
"@freecodecamp/react-calendar-heatmap": "1.1.0", "@freecodecamp/react-calendar-heatmap": "1.1.0",
"@freecodecamp/strip-comments": "3.0.1",
"@freecodecamp/ui": "1.2.0", "@freecodecamp/ui": "1.2.0",
"@growthbook/growthbook-react": "0.20.0", "@growthbook/growthbook-react": "0.20.0",
"@loadable/component": "5.16.3", "@loadable/component": "5.16.3",
@@ -60,33 +59,25 @@
"@stripe/stripe-js": "1.54.2", "@stripe/stripe-js": "1.54.2",
"algoliasearch": "4.22.1", "algoliasearch": "4.22.1",
"assert": "2.0.0", "assert": "2.0.0",
"babel-loader": "8.3.0",
"babel-plugin-preval": "5.1.0", "babel-plugin-preval": "5.1.0",
"babel-plugin-prismjs": "2.1.0", "babel-plugin-prismjs": "2.1.0",
"bezier-easing": "2.1.0", "bezier-easing": "2.1.0",
"browser-cookies": "1.2.0", "browser-cookies": "1.2.0",
"buffer": "6.0.3",
"canvas-confetti": "^1.6.0", "canvas-confetti": "^1.6.0",
"chai": "4.4.1",
"crypto-browserify": "3.12.0", "crypto-browserify": "3.12.0",
"date-fns": "2.30.0", "date-fns": "2.30.0",
"enzyme": "3.11.0",
"final-form": "4.20.10", "final-form": "4.20.10",
"gatsby": "3.15.0", "gatsby": "3.15.0",
"gatsby-cli": "3.15.0", "gatsby-cli": "3.15.0",
"gatsby-link": "3.15.0",
"gatsby-plugin-advanced-sitemap": "2.1.0",
"gatsby-plugin-create-client-paths": "3.15.0", "gatsby-plugin-create-client-paths": "3.15.0",
"gatsby-plugin-manifest": "3.15.0", "gatsby-plugin-manifest": "3.15.0",
"gatsby-plugin-pnpm": "^1.2.10", "gatsby-plugin-pnpm": "^1.2.10",
"gatsby-plugin-postcss": "4.15.0", "gatsby-plugin-postcss": "4.15.0",
"gatsby-plugin-react-helmet": "4.15.0", "gatsby-plugin-react-helmet": "4.15.0",
"gatsby-plugin-remove-serviceworker": "1.0.0", "gatsby-plugin-remove-serviceworker": "1.0.0",
"gatsby-remark-prismjs": "5.12.0",
"gatsby-source-filesystem": "3.15.0", "gatsby-source-filesystem": "3.15.0",
"gatsby-transformer-remark": "5.25.1", "gatsby-transformer-remark": "5.25.1",
"i18next": "22.5.1", "i18next": "22.5.1",
"jquery": "3.7.1",
"lodash": "4.17.21", "lodash": "4.17.21",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",
"micromark": "4.0.0", "micromark": "4.0.0",
@@ -125,8 +116,6 @@
"reselect": "4.1.8", "reselect": "4.1.8",
"rxjs": "6.6.7", "rxjs": "6.6.7",
"sanitize-html": "2.11.0", "sanitize-html": "2.11.0",
"sass.js": "0.11.1",
"sha-1": "1.0.0",
"store": "2.0.12", "store": "2.0.12",
"stream-browserify": "3.0.0", "stream-browserify": "3.0.0",
"tone": "14.7.77", "tone": "14.7.77",
@@ -139,15 +128,10 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/plugin-syntax-dynamic-import": "7.8.3", "@babel/plugin-syntax-dynamic-import": "7.8.3",
"@testing-library/jest-dom": "5.17.0",
"@testing-library/react": "12.1.5", "@testing-library/react": "12.1.5",
"@total-typescript/ts-reset": "^0.5.0", "@total-typescript/ts-reset": "^0.5.0",
"@types/canvas-confetti": "^1.6.0", "@types/canvas-confetti": "^1.6.0",
"@types/chai": "^4.3.4",
"@types/enzyme": "^3.10.12",
"@types/enzyme-adapter-react-16": "1.0.9",
"@types/jest": "29.5.12", "@types/jest": "29.5.12",
"@types/jquery": "^3.5.16",
"@types/js-yaml": "4.0.5", "@types/js-yaml": "4.0.5",
"@types/loadable__component": "5.13.8", "@types/loadable__component": "5.13.8",
"@types/lodash-es": "^4.17.6", "@types/lodash-es": "^4.17.6",
@@ -169,18 +153,12 @@
"@types/redux-actions": "2.6.5", "@types/redux-actions": "2.6.5",
"@types/sanitize-html": "^2.8.0", "@types/sanitize-html": "^2.8.0",
"@types/store": "^2.0.2", "@types/store": "^2.0.2",
"@types/testing-library__jest-dom": "^5.14.5",
"@types/validator": "^13.7.12", "@types/validator": "^13.7.12",
"autoprefixer": "10.4.17", "autoprefixer": "10.4.17",
"babel-plugin-macros": "3.1.0", "babel-plugin-macros": "3.1.0",
"babel-plugin-transform-imports": "2.0.0",
"chokidar": "3.6.0",
"copy-webpack-plugin": "9.1.0",
"core-js": "2.6.12", "core-js": "2.6.12",
"dotenv": "16.4.5", "dotenv": "16.4.5",
"eslint-plugin-testing-library": "^3.9.0",
"gatsby-plugin-webpack-bundle-analyser-v2": "1.1.32", "gatsby-plugin-webpack-bundle-analyser-v2": "1.1.32",
"jest-environment-jsdom": "29.7.0",
"jest-json-schema-extended": "1.0.1", "jest-json-schema-extended": "1.0.1",
"joi": "17.12.2", "joi": "17.12.2",
"js-yaml": "4.1.0", "js-yaml": "4.1.0",
@@ -190,7 +168,6 @@
"redux-saga-test-plan": "4.0.6", "redux-saga-test-plan": "4.0.6",
"serve": "13.0.4", "serve": "13.0.4",
"ts-node": "10.9.2", "ts-node": "10.9.2",
"webpack": "5.90.3", "webpack": "5.90.3"
"webpack-cli": "4.10.0"
} }
} }
@@ -59,7 +59,7 @@ export const ThankYouMessage = ({
); );
}; };
export const OtherWaysToSupport = (): JSX.Element => { const OtherWaysToSupport = (): JSX.Element => {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<> <>
@@ -225,7 +225,7 @@ export const SupportBenefitsText = ({
); );
}; };
export const BenefitsList = (): JSX.Element => { const BenefitsList = (): JSX.Element => {
const { t } = useTranslation(); const { t } = useTranslation();
return ( return (
<ul> <ul>
@@ -3,7 +3,7 @@ import { Button } from '@freecodecamp/ui';
import Link from './link'; import Link from './link';
export type ButtonSize = 'small' | 'medium' | 'large'; type ButtonSize = 'small' | 'medium' | 'large';
interface Props extends React.AnchorHTMLAttributes<HTMLAnchorElement> { interface Props extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
children: React.ReactNode; children: React.ReactNode;
@@ -5,20 +5,6 @@ const { clientLocale } = envData;
const localeCode = getLangCode(clientLocale); const localeCode = getLangCode(clientLocale);
const formatYears = (array: string[], t: TFunction): string => {
return array.reduce((string, item, index, array) => {
if (string.length > 0) {
if (index === array.length - 1) {
return `${string} ${t('misc.and')} ${item}`;
} else {
return `${string}, ${item}`;
}
} else {
return item;
}
});
};
const parseDate = (joinDate: string, t: TFunction): string => { const parseDate = (joinDate: string, t: TFunction): string => {
const convertedJoinDate = new Date(joinDate); const convertedJoinDate = new Date(joinDate);
const date = convertedJoinDate.toLocaleString([localeCode, 'en-US'], { const date = convertedJoinDate.toLocaleString([localeCode, 'en-US'], {
@@ -28,4 +14,4 @@ const parseDate = (joinDate: string, t: TFunction): string => {
return t('profile.joined', { date: date }); return t('profile.joined', { date: date });
}; };
export { formatYears, parseDate }; export { parseDate };
+1 -1
View File
@@ -6,7 +6,7 @@ export const hastag = '%23';
export const nextLine = '%0A'; export const nextLine = '%0A';
export const action = 'intent/tweet'; export const action = 'intent/tweet';
export const twitterDomain = 'twitter.com'; export const twitterDomain = 'twitter.com';
export const freecodecampLearnDomainURL = 'www.freecodecamp.org/learn'; const freecodecampLearnDomainURL = 'www.freecodecamp.org/learn';
export const twitterDevelpoerDomainURL = 'https://developer.twitter.com'; export const twitterDevelpoerDomainURL = 'https://developer.twitter.com';
export const useShare = ({ superBlock, block }: ShareProps): string => { export const useShare = ({ superBlock, block }: ShareProps): string => {
+7 -7
View File
@@ -30,7 +30,7 @@ export type MarkdownRemark = {
id: string; id: string;
}; };
export type MultipleChoiceAnswer = { type MultipleChoiceAnswer = {
answer: string; answer: string;
feedback: string | null; feedback: string | null;
}; };
@@ -71,7 +71,7 @@ export interface VideoLocaleIds {
} }
// English types for animations // English types for animations
export interface Dialogue { interface Dialogue {
text: string; text: string;
align: 'left' | 'right' | 'center'; align: 'left' | 'right' | 'center';
} }
@@ -82,7 +82,7 @@ export interface CharacterPosition {
z?: number; z?: number;
} }
export interface SceneCommand { interface SceneCommand {
background?: string; background?: string;
character: string; character: string;
position?: CharacterPosition; position?: CharacterPosition;
@@ -117,21 +117,21 @@ export type Characters =
| 'Sophie' | 'Sophie'
| 'Tom'; | 'Tom';
export interface SetupCharacter { interface SetupCharacter {
character: Characters; character: Characters;
position: CharacterPosition; position: CharacterPosition;
opacity: number; opacity: number;
isTalking?: boolean; isTalking?: boolean;
} }
export interface SetupAudio { interface SetupAudio {
filename: string; filename: string;
startTime: number; startTime: number;
startTimestamp?: number; startTimestamp?: number;
finishTimestamp?: number; finishTimestamp?: number;
} }
export interface SceneSetup { interface SceneSetup {
background: string; background: string;
characters: SetupCharacter[]; characters: SetupCharacter[];
audio: SetupAudio; audio: SetupAudio;
@@ -456,7 +456,7 @@ export interface GeneratedExamQuestion {
answers: GeneratedExamAnswer[]; answers: GeneratedExamAnswer[];
} }
export interface GenerateExamResponse { interface GenerateExamResponse {
error?: string; error?: string;
generatedExam?: GeneratedExamQuestion[]; generatedExam?: GeneratedExamQuestion[];
} }
-1
View File
@@ -12,7 +12,6 @@ export const partiallyCompletedChallengesSelector = state =>
userSelector(state).partiallyCompletedChallenges || []; userSelector(state).partiallyCompletedChallenges || [];
export const currentChallengeIdSelector = state => export const currentChallengeIdSelector = state =>
state[MainApp].currentChallengeId; state[MainApp].currentChallengeId;
export const completionCountSelector = state => state[MainApp].completionCount;
export const isRandomCompletionThresholdSelector = state => export const isRandomCompletionThresholdSelector = state =>
state[MainApp].isRandomCompletionThreshold; state[MainApp].isRandomCompletionThreshold;
export const isDonatingSelector = state => userSelector(state).isDonating; export const isDonatingSelector = state => userSelector(state).isDonating;
+1 -1
View File
@@ -46,6 +46,6 @@ export const initializeMathJax = (mathJaxChallenge = true) => {
} }
}; };
export const mathJaxScriptLoader = () => { const mathJaxScriptLoader = () => {
scriptLoader('mathjax', false, mathJaxSrc, configure, ''); scriptLoader('mathjax', false, mathJaxSrc, configure, '');
}; };
+1 -5
View File
@@ -1,5 +1 @@
const challengePageCreators = require('./challenge-page-creator'); module.exports = require('./challenge-page-creator');
module.exports = {
...challengePageCreators
};
+1 -11
View File
@@ -41,18 +41,9 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.23.7", "@babel/core": "7.23.7",
"@babel/preset-env": "7.23.7",
"@babel/preset-typescript": "7.23.3",
"@babel/register": "7.23.7", "@babel/register": "7.23.7",
"@compodoc/live-server": "^1.2.3", "@compodoc/live-server": "^1.2.3",
"babel-plugin-dynamic-import-node": "2.3.3",
"babel-plugin-lodash": "3.3.4",
"babel-plugin-transform-runtime": "6.23.0",
"babel-preset-env": "1.7.0",
"babel-preset-react": "6.24.1",
"babel-preset-stage-0": "6.24.1",
"chai": "4.4.1", "chai": "4.4.1",
"css": "3.0.0",
"glob": "8.1.0", "glob": "8.1.0",
"invariant": "2.2.4", "invariant": "2.2.4",
"joi": "17.12.2", "joi": "17.12.2",
@@ -65,7 +56,6 @@
"ora": "5.4.1", "ora": "5.4.1",
"puppeteer": "22.12.1", "puppeteer": "22.12.1",
"readdirp": "3.6.0", "readdirp": "3.6.0",
"string-similarity": "4.0.4", "string-similarity": "4.0.4"
"unist-util-visit": "2.0.3"
} }
} }
+43 -15
View File
@@ -1,27 +1,55 @@
{ {
"$schema": "https://unpkg.com/knip@1/schema.json", "$schema": "https://unpkg.com/knip@5/schema.json",
"ignoreBinaries": ["create:shared", "install-puppeteer", "pm2"],
"ignore": "**/*.d.ts", "ignoreWorkspaces": ["api-server"], // Ignored based on https://github.com/freeCodeCamp/freeCodeCamp/pull/52330#issuecomment-1807917235
// Only workspaces with a configuration below are analyzed by Knip
"workspaces": { "workspaces": {
".": { ".": {
// No custom entry/project files in root workspace to not interfere with workspaces that are not set up yet "playwright": [
"entry": [] "playwright.config.ts",
"playwright-mobile.config.ts" // How/where is this file used?
],
"ignore": ["tools/scripts/redirect-gen.ts"] // Referenced in tools/scripts/redirect-gen.ts
},
"api": {
"ignoreDependencies": ["pino-pretty"] // Knip doesn't have a fastify plugin yet
}, },
"client": { "client": {
"entry": ["static/**/*.js"],
"webpack": "webpack-workers.js", "webpack": "webpack-workers.js",
"ignore": ["**/__mocks__"] "ignore": [
"**/__mocks__/**",
"tailwind.config.js",
"src/assets/icons/*.tsx" // Ignored based on https://github.com/freeCodeCamp/freeCodeCamp/pull/56244#issuecomment-2367830791
],
"ignoreDependencies": [
"core-js",
// Node.js built-ins need to be ignored
"process",
"util",
"assert",
"@redux-saga/core" // Not referenced, something seems off related to peer dep and types
]
}, },
"client/plugins/*": { "curriculum": {
"entry": "gatsby-node.js" "ignoreDependencies": ["invariant"] // Used from another workspace: shared/utils/polyvinyl.js
},
"shared": {
"ignore": ["{config,utils}/*.ts"] // Using the same dir for src + outDir files with tsc confuses Knip
},
"tools/challenge-helper-scripts": {
"ignoreBinaries": ["mocha"] // Test setup in this workspace seems to be in need of a checkup
},
"tools/challenge-parser": {
"entry": ["parser/tools/*.js"] // Files not referenced/documented?
},
"tools/client-plugins/browser-scripts": {
"ignoreDependencies": ["sass.js", "xterm", "process", "util"] // Node.js built-ins need to be ignored
}, },
"tools/scripts/build": { "tools/scripts/build": {
"entry": ["*.ts"] "entry": ["*.ts"]
},
"tools/scripts/seed-exams": {
"entry": ["add-nano-ids.js"] // Referenced in tools/scripts/seed-exams/README.md
} }
}, }
"ignoreDependencies": [
// framerunner throws error if removed
"@babel/runtime"
]
} }
+9 -14
View File
@@ -19,7 +19,7 @@
"author": "freeCodeCamp <team@freecodecamp.org>", "author": "freeCodeCamp <team@freecodecamp.org>",
"main": "none", "main": "none",
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm", "preinstall": "npx -y only-allow pnpm",
"audit-challenges": "pnpm run create:shared && ts-node tools/challenge-auditor/index.ts", "audit-challenges": "pnpm run create:shared && ts-node tools/challenge-auditor/index.ts",
"analyze-bundle": "webpack-bundle-analyzer", "analyze-bundle": "webpack-bundle-analyzer",
"prebuild": "npm-run-all create:shared", "prebuild": "npm-run-all create:shared",
@@ -48,8 +48,8 @@
"format:eslint": "eslint . --fix", "format:eslint": "eslint . --fix",
"format:prettier": "prettier --write .", "format:prettier": "prettier --write .",
"i18n-sync": "ts-node ./tools/scripts/sync-i18n.ts", "i18n-sync": "ts-node ./tools/scripts/sync-i18n.ts",
"knip": "npx -y knip@1 --include files", "knip": "npx -y knip@5 --include files",
"knip:all": "npx -y knip@1", "knip:all": "npx -y knip@5 ",
"prelint": "pnpm run -F=client predevelop", "prelint": "pnpm run -F=client predevelop",
"lint": "NODE_OPTIONS=\"--max-old-space-size=7168\" npm-run-all create:shared -p lint:*", "lint": "NODE_OPTIONS=\"--max-old-space-size=7168\" npm-run-all create:shared -p lint:*",
"lint:challenges": "cd ./curriculum && pnpm run lint", "lint:challenges": "cd ./curriculum && pnpm run lint",
@@ -90,22 +90,17 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/eslint-parser": "7.23.3", "@babel/eslint-parser": "7.23.3",
"@babel/plugin-proposal-function-bind": "7.23.3",
"@babel/preset-env": "7.23.7",
"@babel/preset-react": "7.23.3", "@babel/preset-react": "7.23.3",
"@babel/preset-typescript": "7.23.3",
"@playwright/test": "^1.47.1", "@playwright/test": "^1.47.1",
"@testing-library/dom": "9.3.4", "@testing-library/dom": "9.3.4",
"@testing-library/jest-dom": "6.4.2", "@testing-library/jest-dom": "5.17.0",
"@testing-library/user-event": "14.5.2",
"@types/jest": "29.5.12", "@types/jest": "29.5.12",
"@types/lodash": "4.14.202", "@types/lodash": "4.14.202",
"@types/node": "20.12.8", "@types/node": "20.12.8",
"@types/store": "2.0.5", "@types/testing-library__jest-dom": "^5.14.5",
"@typescript-eslint/eslint-plugin": "7.1.1", "@typescript-eslint/eslint-plugin": "7.1.1",
"@typescript-eslint/parser": "7.1.1", "@typescript-eslint/parser": "7.1.1",
"babel-jest": "29.7.0", "babel-jest": "29.7.0",
"babel-plugin-transform-imports": "2.0.0",
"eslint": "8.57.0", "eslint": "8.57.0",
"eslint-config-prettier": "9.1.0", "eslint-config-prettier": "9.1.0",
"eslint-import-resolver-typescript": "^3.5.5", "eslint-import-resolver-typescript": "^3.5.5",
@@ -119,7 +114,9 @@
"eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-testing-library": "6.2.0", "eslint-plugin-testing-library": "6.2.0",
"husky": "9.0.11", "husky": "9.0.11",
"identity-obj-proxy": "^3.0.0",
"jest": "29.7.0", "jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"js-yaml": "3.14.1", "js-yaml": "3.14.1",
"lint-staged": "^13.1.0", "lint-staged": "^13.1.0",
"lodash": "4.17.21", "lodash": "4.17.21",
@@ -127,12 +124,10 @@
"npm-run-all2": "5.0.2", "npm-run-all2": "5.0.2",
"prettier": "3.2.5", "prettier": "3.2.5",
"prismjs": "1.29.0", "prismjs": "1.29.0",
"process": "0.11.10",
"start-server-and-test": "2.0.3",
"store": "2.0.12",
"ts-node": "10.9.2", "ts-node": "10.9.2",
"typescript": "5.4.5", "typescript": "5.4.5",
"webpack-bundle-analyzer": "4.10.1", "webpack-bundle-analyzer": "4.10.1",
"yargs": "17.7.2" "yargs": "17.7.2"
} },
"packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c"
} }
+236 -1619
View File
File diff suppressed because it is too large Load Diff
-1
View File
@@ -10,7 +10,6 @@ SENTRY_ENVIRONMENT=staging
AUTH0_CLIENT_ID=client_id_from_auth0_dashboard AUTH0_CLIENT_ID=client_id_from_auth0_dashboard
AUTH0_CLIENT_SECRET=client_secret_from_auth0_dashboard AUTH0_CLIENT_SECRET=client_secret_from_auth0_dashboard
AUTH0_DOMAIN=example.auth0.com AUTH0_DOMAIN=example.auth0.com
AUTH0_AUDIENCE=sample_audience
# Session, Cookie and JWT encryption strings # Session, Cookie and JWT encryption strings
SESSION_SECRET=a_thirty_two_plus_character_session_secret SESSION_SECRET=a_thirty_two_plus_character_session_secret
-11
View File
@@ -87,16 +87,6 @@ function setExt(ext, poly) {
return newPoly; return newPoly;
} }
// setImportedFiles(importedFiles: String[], poly: PolyVinyl) => PolyVinyl
function setImportedFiles(importedFiles, poly) {
checkPoly(poly);
const newPoly = {
...poly,
importedFiles: [...importedFiles]
};
return newPoly;
}
// This is currently only used to add back properties that are not stored in the // This is currently only used to add back properties that are not stored in the
// database. // database.
function regeneratePathAndHistory(poly) { function regeneratePathAndHistory(poly) {
@@ -162,7 +152,6 @@ module.exports = {
isPoly, isPoly,
setContent, setContent,
setExt, setExt,
setImportedFiles,
compileHeadTail, compileHeadTail,
regeneratePathAndHistory, regeneratePathAndHistory,
transformContents, transformContents,
+1 -3
View File
@@ -9,8 +9,7 @@
"react-dom": "16.14.0", "react-dom": "16.14.0",
"react-router-dom": "6.18.0", "react-router-dom": "6.18.0",
"typescript": "5.2.2", "typescript": "5.2.2",
"vite": "4.5.2", "vite": "4.5.2"
"vite-tsconfig-paths": "4.2.1"
}, },
"scripts": { "scripts": {
"start": "PORT=3300 vite", "start": "PORT=3300 vite",
@@ -24,7 +23,6 @@
"@types/react": "16.14.56", "@types/react": "16.14.56",
"@types/react-dom": "16.9.24", "@types/react-dom": "16.9.24",
"@uiw/react-codemirror": "3.2.10", "@uiw/react-codemirror": "3.2.10",
"eslint-plugin-react-hooks": "4.6.0",
"shx": "0.3.4" "shx": "0.3.4"
} }
} }
@@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
@@ -5,7 +5,7 @@ const sanitizeTitle = (title: string) => {
return title.includes(':') || title.includes("'") ? `"${title}"` : title; return title.includes(':') || title.includes("'") ? `"${title}"` : title;
}; };
export interface ChallengeOptions { interface ChallengeOptions {
challengeId: ObjectID; challengeId: ObjectID;
title: string; title: string;
dashedName: string; dashedName: string;
@@ -37,7 +37,7 @@ challengeType: ${challengeType}
dashedName: ${dashedName} dashedName: ${dashedName}
---`; ---`;
export const getLegacyChallengeTemplate = ( const getLegacyChallengeTemplate = (
options: ChallengeOptions options: ChallengeOptions
): string => `${buildFrontMatter(options)} ): string => `${buildFrontMatter(options)}
@@ -70,7 +70,7 @@ Test 1
\`\`\` \`\`\`
`; `;
export const getQuizChallengeTemplate = ( const getQuizChallengeTemplate = (
options: ChallengeOptions options: ChallengeOptions
): string => `${buildFrontMatter(options)} ): string => `${buildFrontMatter(options)}
@@ -524,7 +524,7 @@ Placeholder answer
`; `;
export const getVideoChallengeTemplate = ( const getVideoChallengeTemplate = (
options: ChallengeOptions options: ChallengeOptions
): string => `${buildFrontMatterWithVideo(options)} ): string => `${buildFrontMatterWithVideo(options)}
@@ -555,7 +555,7 @@ Answer 3
1 1
`; `;
export const getAssignmentChallengeTemplate = ( const getAssignmentChallengeTemplate = (
options: ChallengeOptions options: ChallengeOptions
): string => `${buildFrontMatter(options)} ): string => `${buildFrontMatter(options)}
@@ -590,7 +590,7 @@ Answer 3
1 1
`; `;
export const getMultipleChoiceChallengeTemplate = ( const getMultipleChoiceChallengeTemplate = (
options: ChallengeOptions options: ChallengeOptions
): string => `${buildFrontMatter(options)} ): string => `${buildFrontMatter(options)}
@@ -621,7 +621,7 @@ Answer 3
1 1
`; `;
export const getFillInTheBlankChallengeTemplate = ( const getFillInTheBlankChallengeTemplate = (
options: ChallengeOptions options: ChallengeOptions
): string => `${buildFrontMatter(options)} ): string => `${buildFrontMatter(options)}
@@ -648,7 +648,7 @@ It's \`in\`
\`blank\` \`blank\`
`; `;
export const getDialogueChallengeTemplate = ( const getDialogueChallengeTemplate = (
options: ChallengeOptions options: ChallengeOptions
): string => `${buildFrontMatter(options)} ): string => `${buildFrontMatter(options)}
@@ -1,35 +0,0 @@
const visitChildren = require('unist-util-visit-children');
function hasId(node, index, parent) {
// image references should always be inside paragraphs.
if (node.type !== 'paragraph') return;
const idHolder = node.children[0];
if (idHolder.type === 'imageReference') {
if (node.children.length > 1) {
console.log('oooops, too many links together!');
// TODO: optional chaining
} else if (
parent.children[index + 1] &&
parent.children[index + 1].type === 'code'
) {
console.log('found adjacent code block for id ' + idHolder.identifier);
} else {
console.log(
'ooops! the id ' + idHolder.identifier + ' is not next to a code block'
);
}
}
}
function plugin() {
// we don't want to recurse into the tree, hence visitChildren
const visit = visitChildren(hasId);
return transformer;
function transformer(tree) {
visit(tree);
}
}
module.exports = plugin;
@@ -36,10 +36,8 @@
"@types/jquery": "3.5.29", "@types/jquery": "3.5.29",
"@types/lodash-es": "4.17.12", "@types/lodash-es": "4.17.12",
"babel-loader": "8.3.0", "babel-loader": "8.3.0",
"buffer": "6.0.3",
"chai": "4.4.1", "chai": "4.4.1",
"copy-webpack-plugin": "9.1.0", "copy-webpack-plugin": "9.1.0",
"css-loader": "^6.8.1",
"enzyme": "3.11.0", "enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.8", "enzyme-adapter-react-16": "1.15.8",
"jquery": "3.7.1", "jquery": "3.7.1",
@@ -47,14 +45,11 @@
"process": "0.11.10", "process": "0.11.10",
"pyodide": "^0.23.3", "pyodide": "^0.23.3",
"sass.js": "0.11.1", "sass.js": "0.11.1",
"style-loader": "^3.3.3",
"util": "0.12.5", "util": "0.12.5",
"webpack": "5.90.3", "webpack": "5.90.3",
"webpack-cli": "4.10.0" "webpack-cli": "4.10.0"
}, },
"dependencies": { "dependencies": {
"@babel/runtime": "^7.20.13", "xterm": "^5.2.1"
"xterm": "^5.2.1",
"xterm-addon-fit": "^0.8.0"
} }
} }
-1
View File
@@ -24,7 +24,6 @@
"joi": "17.12.2", "joi": "17.12.2",
"joi-objectid": "3.0.1", "joi-objectid": "3.0.1",
"js-yaml": "4.1.0", "js-yaml": "4.1.0",
"lodash": "4.17.21",
"mongodb": "5.9.2", "mongodb": "5.9.2",
"nanoid": "4.0.2" "nanoid": "4.0.2"
}, },
-1
View File
@@ -21,7 +21,6 @@
"devDependencies": { "devDependencies": {
"debug": "4.3.4", "debug": "4.3.4",
"dotenv": "16.4.5", "dotenv": "16.4.5",
"lodash": "4.17.21",
"mongodb": "5.9.2" "mongodb": "5.9.2"
} }
} }
+12253 -12251
View File
File diff suppressed because it is too large Load Diff