Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Change repo to follow project template
Change to line up this repo with the template found [here](https://github.coventry.ac.uk/web/template-dynamic-websites). This includes: - ESLint config changes and code reformated to reflect this - githooks - DbContext not implemented error - JSDoc config added - Jest config changed - VSCode config changed to line up with ESLint
- Loading branch information
Showing
18 changed files
with
366 additions
and
341 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,74 @@ | ||
|
||
{ | ||
"extends": "standard", | ||
"env": { | ||
"es6": true, | ||
"jasmine": true, | ||
"node": true, | ||
"browser": true, | ||
"jest": true | ||
}, | ||
"parserOptions": { | ||
"ecmaVersion": 8 | ||
}, | ||
"rules": { | ||
"arrow-body-style": 2, | ||
"arrow-spacing": ["warn", {"before": true, "after": true}], | ||
"brace-style": 2, | ||
"camelcase": [2, {"properties": "never"}], | ||
"complexity": ["error", 5], | ||
"eol-last": "warn", | ||
"eqeqeq": "error", | ||
"func-call-spacing": ["error", "never"], | ||
"global-require": "error", | ||
"handle-callback-err": "warn", | ||
"indent": [1, "tab", {"SwitchCase": 1}], | ||
"key-spacing": ["error", {"beforeColon": false, "afterColon": true}], | ||
"linebreak-style": ["warn", "unix"], | ||
"max-depth": ["error", 3], | ||
"max-len": ["warn", { "code": 120, "tabWidth": 4 }], | ||
"max-lines": ["warn", 150], | ||
"max-lines-per-function": ["error", 20], | ||
"max-nested-callbacks": ["error", 4], | ||
"max-params": ["error", 5], | ||
"max-statements": ["error", 20], | ||
"no-cond-assign": 2, | ||
"no-dupe-args": "error", | ||
"no-dupe-keys": "error", | ||
"no-duplicate-case": "error", | ||
"no-empty": "warn", | ||
"no-empty-function": 2, | ||
"no-multiple-empty-lines": "warn", | ||
"no-extra-parens": 2, | ||
"no-func-assign": 2, | ||
"no-irregular-whitespace": 2, | ||
"no-magic-numbers": [1, {"ignore": [-1, 0, 1]}], | ||
"no-multi-spaces": 1, | ||
"no-multi-str": 1, | ||
"no-unexpected-multiline": 2, | ||
"no-unreachable": 2, | ||
"no-self-assign": 2, | ||
"no-trailing-spaces": 1, | ||
"no-undef": 2, | ||
"no-unused-vars": 1, | ||
"no-var": 2, | ||
"prefer-arrow-callback": 1, | ||
"prefer-const": 2, | ||
"prefer-template": "error", | ||
"quotes": [1, "single"], | ||
"semi": [1, "never"], | ||
"space-before-blocks": ["error", { "functions": "always", "keywords": "always", "classes": "always" }], | ||
"space-before-function-paren": [2, "never"], | ||
"strict": [2, "global"], | ||
"yoda": 2 | ||
}, | ||
"overrides": [{ | ||
"files": [ "*.test.js", "*.spec.js", "sqlite-async.js" ], | ||
"rules": { | ||
"space-before-function-paren": "off" | ||
"global-require": "off", | ||
"max-lines-per-function": "off", | ||
"max-lines": "off", | ||
"max-statements": "off", | ||
"no-magic-numbers": "off" | ||
} | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
echo "running the 'post-commit' script" | ||
./node_modules/.bin/markdownlint --ignore node_modules . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
|
||
echo "running the 'pre-commit' script" | ||
./node_modules/.bin/eslint . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
node_modules | ||
|
||
# ignore sqlite databases | ||
*.db | ||
.DS_Store | ||
node_modules/ | ||
coverage/ | ||
*.db | ||
screenshots/* | ||
docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
{ | ||
"editor.tabSize": 2 | ||
} | ||
"editor.insertSpaces": false, | ||
"editor.tabSize": 2, | ||
"files.eol": "\n" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,20 @@ | ||
#!/usr/bin/env node | ||
|
||
'use strict' | ||
|
||
const fs = require('fs') | ||
const path = require('path') | ||
|
||
const sqlite = require('sqlite') | ||
|
||
sqlite.open('app.db').then(db => { | ||
const sqlPath = path.join(__dirname, 'build_db.sql') | ||
fs.readFile(sqlPath, 'utf8', async (err, sql) => { | ||
if (err) { | ||
console.error(err) | ||
process.exit(1) | ||
} | ||
const sqlPath = path.join(__dirname, 'build_db.sql') | ||
fs.readFile(sqlPath, 'utf8', async(err, sql) => { | ||
if (err) { | ||
console.error(err) | ||
process.exit(1) | ||
} | ||
|
||
await db.exec(sql) | ||
}) | ||
await db.exec(sql) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
'use strict' | ||
|
||
const Router = require('koa-router') | ||
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
'use strict' | ||
|
||
const Router = require('koa-router') | ||
|
||
const login = new Router({ prefix: '/login' }) | ||
|
||
login.get('/', async ctx => { | ||
await ctx.render('login.hbs') | ||
await ctx.render('login.hbs') | ||
}) | ||
|
||
login.post('/', async ctx => { | ||
console.log(ctx.query) | ||
console.log(ctx.querystring) | ||
console.log(ctx.query) | ||
console.log(ctx.querystring) | ||
}) | ||
|
||
module.exports = login |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.