Skip to content
Open
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
18 changes: 18 additions & 0 deletions .eslintoutputrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"files": [
"."
],
"formats": [
{
"name": "stylish",
"output": "console"
},
{
"name": "html",
"output": "file",
"path": "dist/lint.html",
"id": "html"
}
],
"eslintConfig": {}
}
99 changes: 99 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
module.exports = {
env: {
es2022: true,
node: true,
browser: true,
},
settings: {
react: {
version: "detect",
},
},
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
],
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "react"],
overrides: [
{
files: ["src/**/*.test.ts", "src/**/*.test.tsx"],
env: {
jest: true,
},
},
],
parserOptions: {
ecmaVersion: 12,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
project: ["./tsconfig.json"],
},
ignorePatterns: [".eslintrc.js", "jest.config.js"],
rules: {
// https://stackoverflow.com/questions/57802057/eslint-configuring-no-unused-vars-for-typescript
// Use typescript's checker for unused vars (critical for Enums)
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error"],
// https://typescript-eslint.io/rules/no-use-before-define
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": "error",

// https://typescript-eslint.io/rules/ban-ts-comment
// Disallow @ts-<directive> comments or require descriptions after directives.
"@typescript-eslint/ban-ts-comment": "error",

// https://typescript-eslint.io/rules/no-explicit-any
// Disallow the any type.
//"@typescript-eslint/no-explicit-any": "error",

// https://typescript-eslint.io/rules/no-unsafe-assignment
// Disallow assigning a value with type any to variables and properties.
"@typescript-eslint/no-unsafe-assignment": "error",

// https://typescript-eslint.io/rules/no-unsafe-return
// Disallow returning a value with type any from a function.
"@typescript-eslint/no-unsafe-return": "error",

// https://typescript-eslint.io/rules/ban-types
// Disallow certain types.
"@typescript-eslint/no-restricted-types": [
"error",
{
types: {
unknown:
"That is not allowed in this course. You should be able to specify the type more clearly!",
any: "That is not allowed in this course. You should be able to figure out the type!",
},
},
],
// https://typescript-eslint.io/rules/no-array-constructor
// Disallow generic Array constructors.
"no-array-constructor": "off",
"@typescript-eslint/no-array-constructor": "error",

// https://typescript-eslint.io/rules/no-base-to-string
// Require .toString() to only be called on objects which provide useful information when stringified.
"@typescript-eslint/no-base-to-string": "error",

// https://typescript-eslint.io/rules/no-confusing-void-expression
// Require expressions of type void to appear in statement position.
"@typescript-eslint/no-confusing-void-expression": "error",

// https://typescript-eslint.io/rules/no-for-in-array
// Disallow iterating over an array with a for-in loop. (Force for-of instead!)
"@typescript-eslint/no-for-in-array": "error",

// https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
// Disallow unnecessary equality comparisons against boolean literals.
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",

// https://typescript-eslint.io/rules/no-unnecessary-condition
// Disallow conditionals where the type is always truthy or always falsy.
"@typescript-eslint/no-unnecessary-condition": "error",
},
};
49 changes: 0 additions & 49 deletions .eslintrc.json

This file was deleted.

147 changes: 147 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Workflow for publishing the students' website along with additional helpful information

name: Deploy main branch as website

on:
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- id: get-repo-values
name: Get repository values
run: |
url=https://$(echo "${{github.repository}}" | sed "s/\//.github.io\//")
echo "url=$url" >> $GITHUB_OUTPUT
- name: Update package.json homepage
uses: jossef/action-set-json-field@v1
with:
file: package.json
field: homepage
value: ${{ steps.get-repo-values.outputs.url }}
# create_redirects
- name: Create Redirects and Links
id: create_redirects
run: |
mkdir -p dist
echo "<html><head>\
<meta http-equiv='refresh' content='0; URL=${{github.server_url}}/${{github.repository}}' />\
</head><body>Redirecting to repository</body></html>" > ./dist/repo.html

mkdir -p docs
cp README.md docs/index.md
echo "# Quick Links" > docs/quick-links.md
echo "* [Repository](../repo.html)" >> docs/quick-links.md
echo "<html><head>\
<meta http-equiv='refresh' content='0; URL=docs/quick-links' />\
</head><body>Redirecting to quick links page</body></html>" > ./dist/quick.html
# Install node packages
- name: Install
id: install
run: |
echo "<html><body><pre>" > ./dist/installation.html
npm install |& tee -a ./dist/installation.html
echo "</pre></body></html>" >> ./dist/installation.html
echo "* [Installation](../installation.html)" >> docs/quick-links.md
# Run linter
- name: Run Linter
id: lint
run: |
npm run eslint-output
echo "* [Linter](../lint.html)" >> docs/quick-links.md
# Build the project
- name: Build the project
id: build
run: |
echo "<html><body><pre>" > ./dist/build.html
npm run build |& tee -a ./dist/build.html
mv ./build/* ./dist
echo "</pre></body></html>" >> ./dist/build.html
echo "* [Build](../build.html)" >> docs/quick-links.md
# Run Tests
- name: Run Tests
id: test
run: |
echo "<html><body><pre>" > ./dist/tests.html
npm run test -- --coverage |& tee -a ./dist/tests.html
echo "</pre></body></html>" >> ./dist/tests.html
echo "* [Tests](../tests.html)" >> docs/quick-links.md
# Verify Integrity
- name: Verify Integrity
if: ${{ !cancelled() }}
id: integrity
run: |
echo "<html><body><pre>" > ./dist/integrity.html
find src -type f -name "*.test.ts" -exec md5sum {} + >> ./dist/integrity.html
find src -type f -name "*.test.tsx" -exec md5sum {} + >> ./dist/integrity.html
md5sum .eslintrc.js >> ./dist/integrity.html
md5sum jest.config.js >> ./dist/integrity.html
md5sum tsconfig.json >> ./dist/integrity.html
md5sum .github/workflows/deploy.yml >> ./dist/integrity.html
echo "</pre></body></html>" >> ./dist/integrity.html
echo "* [Integrity](../integrity.html)" >> docs/quick-links.md
# Create GitInspector Report
- name: Create GitInspector Report
if: ${{ !cancelled() }}
id: gitinspector
run: |
git clone https://github.com/jpwhite3/gitinspector.git
python ./gitinspector/gitinspector.py ./ --grading --format=html -f tsx,ts,html,css -x ./gitinspector -x ./node_modules -x ./wbcore > ./dist/git.html
echo "* [Git Inspector](../git.html)" >> docs/quick-links.md
# Generate HTML from Markdown in Docs/
- name: Generate HTML from Markdown in Docs/
if: ${{ !cancelled() }}
id: markdown-docs
uses: ldeluigi/markdown-docs@latest
with:
src: docs
dst: dist/docs/

#- name: Handle Failure
# run: |
# echo "<html><body><h1>Build Failure</h1><p>The build failed during one of the steps.</p>" > ./dist/index.html
#- uses: austenstone/job-summary@v2.0
# id: job-summary
# with:
# create-pdf: false
#- run: |
# echo "${{ steps.job-summary.outputs.job-summary }}" >> ./dist/index.html
# echo "</body></html>" >> ./dist/index.html
# Deploy
- name: Setup Pages
uses: actions/configure-pages@v3
if: ${{ !cancelled() }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
if: ${{ !cancelled() }}
with:
path: "dist/"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
if: ${{ !cancelled() }}
52 changes: 0 additions & 52 deletions .github/workflows/node.js.yml

This file was deleted.

Loading