Skip to content

Commit 04a1ab7

Browse files
Initial commit
0 parents  commit 04a1ab7

29 files changed

+24938
-0
lines changed

.eslintoutputrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"files": [
3+
"."
4+
],
5+
"formats": [
6+
{
7+
"name": "stylish",
8+
"output": "console"
9+
},
10+
{
11+
"name": "html",
12+
"output": "file",
13+
"path": "dist/lint.html",
14+
"id": "html"
15+
}
16+
],
17+
"eslintConfig": {}
18+
}

.eslintrc.js

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
module.exports = {
2+
env: {
3+
es2022: true,
4+
node: true,
5+
browser: true,
6+
},
7+
settings: {
8+
react: {
9+
version: "detect",
10+
},
11+
},
12+
extends: [
13+
"eslint:recommended",
14+
"plugin:react/recommended",
15+
"plugin:react-hooks/recommended",
16+
],
17+
root: true,
18+
parser: "@typescript-eslint/parser",
19+
plugins: ["@typescript-eslint", "react"],
20+
overrides: [
21+
{
22+
files: ["src/**/*.test.ts", "src/**/*.test.tsx"],
23+
env: {
24+
jest: true,
25+
},
26+
},
27+
],
28+
parserOptions: {
29+
ecmaVersion: 12,
30+
sourceType: "module",
31+
ecmaFeatures: {
32+
jsx: true,
33+
},
34+
project: ["./tsconfig.json"],
35+
},
36+
ignorePatterns: [".eslintrc.js", "jest.config.js"],
37+
rules: {
38+
// https://stackoverflow.com/questions/57802057/eslint-configuring-no-unused-vars-for-typescript
39+
// Use typescript's checker for unused vars (critical for Enums)
40+
"no-unused-vars": "off",
41+
"@typescript-eslint/no-unused-vars": ["error"],
42+
// https://typescript-eslint.io/rules/no-use-before-define
43+
"no-use-before-define": "off",
44+
"@typescript-eslint/no-use-before-define": "error",
45+
46+
// https://typescript-eslint.io/rules/ban-ts-comment
47+
// Disallow @ts-<directive> comments or require descriptions after directives.
48+
"@typescript-eslint/ban-ts-comment": "error",
49+
50+
// https://typescript-eslint.io/rules/no-explicit-any
51+
// Disallow the any type.
52+
//"@typescript-eslint/no-explicit-any": "error",
53+
54+
// https://typescript-eslint.io/rules/no-unsafe-assignment
55+
// Disallow assigning a value with type any to variables and properties.
56+
"@typescript-eslint/no-unsafe-assignment": "error",
57+
58+
// https://typescript-eslint.io/rules/no-unsafe-return
59+
// Disallow returning a value with type any from a function.
60+
"@typescript-eslint/no-unsafe-return": "error",
61+
62+
// https://typescript-eslint.io/rules/ban-types
63+
// Disallow certain types.
64+
"@typescript-eslint/no-restricted-types": [
65+
"error",
66+
{
67+
types: {
68+
unknown:
69+
"That is not allowed in this course. You should be able to specify the type more clearly!",
70+
any: "That is not allowed in this course. You should be able to figure out the type!",
71+
},
72+
},
73+
],
74+
// https://typescript-eslint.io/rules/no-array-constructor
75+
// Disallow generic Array constructors.
76+
"no-array-constructor": "off",
77+
"@typescript-eslint/no-array-constructor": "error",
78+
79+
// https://typescript-eslint.io/rules/no-base-to-string
80+
// Require .toString() to only be called on objects which provide useful information when stringified.
81+
"@typescript-eslint/no-base-to-string": "error",
82+
83+
// https://typescript-eslint.io/rules/no-confusing-void-expression
84+
// Require expressions of type void to appear in statement position.
85+
"@typescript-eslint/no-confusing-void-expression": "error",
86+
87+
// https://typescript-eslint.io/rules/no-for-in-array
88+
// Disallow iterating over an array with a for-in loop. (Force for-of instead!)
89+
"@typescript-eslint/no-for-in-array": "error",
90+
91+
// https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
92+
// Disallow unnecessary equality comparisons against boolean literals.
93+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
94+
95+
// https://typescript-eslint.io/rules/no-unnecessary-condition
96+
// Disallow conditionals where the type is always truthy or always falsy.
97+
"@typescript-eslint/no-unnecessary-condition": "error",
98+
},
99+
};

.gitattributes

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# .gitattributes snippet to force users to use same line endings for project.
2+
#
3+
# Handle line endings automatically for files detected as text
4+
# and leave all files detected as binary untouched.
5+
* text=auto
6+
7+
#
8+
# The above will handle all files NOT found below
9+
# https://help.github.com/articles/dealing-with-line-endings/
10+
# https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes
11+
12+
13+
14+
# These files are text and should be normalized (Convert crlf => lf)
15+
*.php text
16+
*.css text
17+
*.js text
18+
*.json text
19+
*.htm text
20+
*.html text
21+
*.xml text
22+
*.txt text
23+
*.ini text
24+
*.inc text
25+
*.pl text
26+
*.rb text
27+
*.py text
28+
*.scm text
29+
*.sql text
30+
.htaccess text
31+
*.sh text
32+
*.svg text
33+
34+
# These files are binary and should be left untouched
35+
# (binary is a macro for -text -diff)
36+
*.png binary
37+
*.jpg binary
38+
*.jpeg binary
39+
*.gif binary
40+
*.ico binary
41+
*.mov binary
42+
*.mp4 binary
43+
*.mp3 binary
44+
*.flv binary
45+
*.fla binary
46+
*.swf binary
47+
*.gz binary
48+
*.zip binary
49+
*.7z binary
50+
*.ttf binary
51+
*.pyc binary

.github/workflows/node.js.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Workflow for publishing the students' website along with additional helpful information
2+
3+
name: Deploy main branch as website
4+
5+
on:
6+
push:
7+
branches: [main]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
deploy:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
- name: Use Node.js ${{ matrix.node-version }}
33+
uses: actions/setup-node@v3
34+
with:
35+
node-version: ${{ matrix.node-version }}
36+
- id: get-repo-values
37+
name: Get repository values
38+
run: |
39+
url=https://$(echo "${{github.repository}}" | sed "s/\//.github.io\//")
40+
echo "url=$url" >> $GITHUB_OUTPUT
41+
- name: Update package.json homepage
42+
uses: jossef/action-set-json-field@v1
43+
with:
44+
file: package.json
45+
field: homepage
46+
value: ${{ steps.get-repo-values.outputs.url }}
47+
# create_redirects
48+
- name: Create Redirects and Links
49+
id: create_redirects
50+
run: |
51+
mkdir -p dist
52+
echo "<html><head>\
53+
<meta http-equiv='refresh' content='0; URL=${{github.server_url}}/${{github.repository}}' />\
54+
</head><body>Redirecting to repository</body></html>" > ./dist/repo.html
55+
56+
mkdir -p docs
57+
cp README.md docs/index.md
58+
echo "# Quick Links" > docs/quick-links.md
59+
echo "* [Repository](../repo.html)" >> docs/quick-links.md
60+
echo "<html><head>\
61+
<meta http-equiv='refresh' content='0; URL=docs/quick-links' />\
62+
</head><body>Redirecting to quick links page</body></html>" > ./dist/quick.html
63+
# Install node packages
64+
- name: Install
65+
id: install
66+
run: |
67+
echo "<html><body><pre>" > ./dist/installation.html
68+
npm install |& tee -a ./dist/installation.html
69+
echo "</pre></body></html>" >> ./dist/installation.html
70+
echo "* [Installation](../installation.html)" >> docs/quick-links.md
71+
# Run linter
72+
- name: Run Linter
73+
id: lint
74+
run: |
75+
npm run eslint-output
76+
echo "* [Linter](../lint.html)" >> docs/quick-links.md
77+
# Build the project
78+
- name: Build the project
79+
id: build
80+
run: |
81+
echo "<html><body><pre>" > ./dist/build.html
82+
npm run build |& tee -a ./dist/build.html
83+
mv ./build/* ./dist
84+
echo "</pre></body></html>" >> ./dist/build.html
85+
echo "* [Build](../build.html)" >> docs/quick-links.md
86+
# Run Tests
87+
- name: Run Tests
88+
id: test
89+
run: |
90+
echo "<html><body><pre>" > ./dist/tests.html
91+
npm run test -- --coverage |& tee -a ./dist/tests.html
92+
echo "</pre></body></html>" >> ./dist/tests.html
93+
echo "* [Tests](../tests.html)" >> docs/quick-links.md
94+
# Verify Integrity
95+
- name: Verify Integrity
96+
if: ${{ !cancelled() }}
97+
id: integrity
98+
run: |
99+
echo "<html><body><pre>" > ./dist/integrity.html
100+
shopt -s globstar
101+
for file in src/**/*.test.ts; do md5sum $file; done >> ./dist/integrity.html
102+
for file in src/**/*.test.tsx; do md5sum $file; done >> ./dist/integrity.html
103+
md5sum .eslintrc.js >> ./dist/integrity.html
104+
md5sum jest.config.js >> ./dist/integrity.html
105+
md5sum tsconfig.json >> ./dist/integrity.html
106+
md5sum .github/workflows/deploy.yml >> ./dist/integrity.html
107+
echo "</pre></body></html>" >> ./dist/integrity.html
108+
echo "* [Integrity](../integrity.html)" >> docs/quick-links.md
109+
# Create GitInspector Report
110+
- name: Create GitInspector Report
111+
if: ${{ !cancelled() }}
112+
id: gitinspector
113+
run: |
114+
git clone https://github.com/jpwhite3/gitinspector.git
115+
python ./gitinspector/gitinspector.py ./ --grading --format=html -f tsx,ts,html,css -x ./gitinspector -x ./node_modules -x ./wbcore > ./dist/git.html
116+
echo "* [Git Inspector](../git.html)" >> docs/quick-links.md
117+
# Generate HTML from Markdown in Docs/
118+
- name: Generate HTML from Markdown in Docs/
119+
if: ${{ !cancelled() }}
120+
id: markdown-docs
121+
uses: ldeluigi/markdown-docs@latest
122+
with:
123+
src: docs
124+
dst: dist/docs/
125+
126+
#- name: Handle Failure
127+
# run: |
128+
# echo "<html><body><h1>Build Failure</h1><p>The build failed during one of the steps.</p>" > ./dist/index.html
129+
#- uses: austenstone/[email protected]
130+
# id: job-summary
131+
# with:
132+
# create-pdf: false
133+
#- run: |
134+
# echo "${{ steps.job-summary.outputs.job-summary }}" >> ./dist/index.html
135+
# echo "</body></html>" >> ./dist/index.html
136+
# Deploy
137+
- name: Setup Pages
138+
uses: actions/configure-pages@v3
139+
if: ${{ !cancelled() }}
140+
- name: Upload artifact
141+
uses: actions/upload-pages-artifact@v2
142+
if: ${{ !cancelled() }}
143+
with:
144+
path: "dist/"
145+
- name: Deploy to GitHub Pages
146+
id: deployment
147+
uses: actions/deploy-pages@v2
148+
if: ${{ !cancelled() }}

0 commit comments

Comments
 (0)