Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement eslint #20

Merged
merged 8 commits into from
Jul 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
env: {
browser: true,
es2021: true,
node: true,
},
extends: ['google'],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
rules: {},
};
15 changes: 0 additions & 15 deletions .eslintrc.json

This file was deleted.

40 changes: 19 additions & 21 deletions .github/workflows/GeoAsteroidsTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: "GeoAsteroidsTest"
on:
push:
pull_request:
branches: [ "main" ]
branches: ["main"]
schedule:
- cron: '0 3 * * 0-6'
- cron: "0 3 * * 0-6"

jobs:
analyze:
Expand All @@ -22,27 +22,25 @@ jobs:
language: ["javascript"]

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "16.x"

- name: Install dependencies
run: npm ci

- name: Lint with eslint
run: npm run lint
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: "16.x"

- name: Install dependencies
run: npm ci

- name: Lint with eslint
run: npm run lint
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# npm test
npm run lint-fix
13 changes: 4 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,17 @@
"request": "launch",
"name": "Start_Node",
"program": "${workspaceFolder}/app.js"

},



{
"name": "Launch_Chrome + node",
"request": "launch",
"type": "chrome",
"webRoot": "/Users/johnsolly/Documents/code/GeoAsteroids/public/",
"runtimeArgs": [
"--incognito",
],
"runtimeArgs": ["--incognito"],
"url": "http://127.0.0.1:4000",
"preLaunchTask": "Launch_Node",
"postDebugTask": "StopTasks"
},
],
}
}
]
}
24 changes: 11 additions & 13 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
{
"python.testing.unittestArgs": [
"-v",
"-s",
"./django_project",
"-p",
"test*.py"
],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"python.testing.pytestArgs": [
"django_project"
]
}
"python.testing.unittestArgs": [
"-v",
"-s",
"./django_project",
"-p",
"test*.py"
],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"python.testing.pytestArgs": ["django_project"]
}
56 changes: 28 additions & 28 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Launch_Node",
"type": "shell",
"command": "node",
"args": ["app.js"],
"isBackground": true,
"problemMatcher": {
"pattern": {
"regexp": "."
},
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "."
}
}
},
{
"label": "StopTasks",
"command": "echo ${input:terminate}",
"type": "shell",
{
"label": "Launch_Node",
"type": "shell",
"command": "node",
"args": ["app.js"],
"isBackground": true,
"problemMatcher": {
"pattern": {
"regexp": "."
},
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": "."
}
}
},
{
"label": "StopTasks",
"command": "echo ${input:terminate}",
"type": "shell"
}
],
"inputs": [
{
"id": "terminate",
"type": "command",
"command": "workbench.action.tasks.terminate",
"args": "terminateAll"
}
{
"id": "terminate",
"type": "command",
"command": "workbench.action.tasks.terminate",
"args": "terminateAll"
}
]
}
}
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ A 2D spaceship game

[![Build Status](http://img.shields.io/travis/badges/badgerbadgerbadger.svg?style=flat-square)](https://travis-ci.org/badges/badgerbadgerbadger) [![Coverage Status](http://img.shields.io/coveralls/badges/badgerbadgerbadger.svg?style=flat-square)](https://coveralls.io/r/badges/badgerbadgerbadger) [![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://badges.mit-license.org)

![GeoAsteroids_playthrough (3)](https://user-images.githubusercontent.com/9572232/179308016-71265497-1d05-4750-bfd5-0f336cf7ae77.gif)


![GeoAsteroids_playthrough (3)](https://user-images.githubusercontent.com/9572232/179308016-71265497-1d05-4750-bfd5-0f336cf7ae77.gif)

---

Expand All @@ -20,8 +20,8 @@ A 2D spaceship game
- [Support](#support)
- [License](#license)


## Installation

```bash
$ git clone git@github.com:jsolly/GeoAsteroids.git
$ node app.js
Expand All @@ -32,19 +32,25 @@ A 2D spaceship game
## Features

#### Functional Features

- Moving asteroids with variable jaggedness and size
- Points, lives and levels
- Spaceship with laser and thruster

#### Non-Functional Features

- Asteroid collisions using circular bounding box
- Static code analysis using CodeQL
- NPM Dependency checking via Dependabot

## Coverage, Tests, Linting

#### Coverage

TODO

#### Test

TODO

---
Expand All @@ -56,10 +62,11 @@ Want to work on this with me? DM me <a href="https://twitter.com/_jsolly" target
### Step 1

- **Option 1**
- 🍴 Fork this repo!

- 🍴 Fork this repo!

- **Option 2**
- 👯 Clone to your local machine using `https://github.com/jsolly/blogthedata.git`
- 👯 Clone to your local machine using `https://github.com/jsolly/blogthedata.git`

### Step 2

Expand Down Expand Up @@ -89,6 +96,7 @@ Reach out to me at one of the following places!
---

## Donations

<a href='https://ko-fi.com/S6S6CSR2Q' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi2.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>

---
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| current | :white_check_mark: |
| current | :white_check_mark: |

## Reporting a Vulnerability

Reach out to me on Twitter @_jsolly. I'll respond within a week.
Reach out to me on Twitter @\_jsolly. I'll respond within a week.
14 changes: 6 additions & 8 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ const path = require('path');
const app = express();

// set up rate limiter: maximum of five requests per minute
var rateLimit = require('express-rate-limit');
const { listenerCount } = require('process');
var limiter = rateLimit({
const rateLimit = require('express-rate-limit');
const limiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 minutes
max: 500, // Limit each IP to 500 requests per `window` (here, per 15 minutes)
});
Expand All @@ -15,12 +14,11 @@ var limiter = rateLimit({
app.use(limiter);

app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, '/public/index.html'));
res.sendFile(path.join(__dirname, '/public/index.html'));
});


app.use(express.static(path.join(__dirname, '/public')));

var listener = app.listen(process.env.PORT || 4000, function () {
console.log('Node app is working on port ' + listener.address().port);
});
const listener = app.listen(process.env.PORT || 4000, function() {
console.log('Node app is working on port ' + listener.address().port);
});
20 changes: 19 additions & 1 deletion config/GeoAsteroids.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@
}
],
"settings": {
"liveServer.settings.CustomBrowser": "chrome:PrivateMode"
"liveServer.settings.CustomBrowser": "chrome:PrivateMode",
"workbench.startupEditor": "none",
"kite.showWelcomeNotificationOnStartup": false,
"liveServer.settings.donotShowInfoMsg": true,
"liveServer.settings.NoBrowser": true,
"explorer.confirmDragAndDrop": false,
"git.confirmSync": false,
"explorer.confirmDelete": false,
"editor.minimap.enabled": false,
"editor.rulers": [80],
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"workbench.colorTheme": "Default Light+",
"javascript.format.enable": false,
"eslint.format.enable": true,
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
}
}
24 changes: 23 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.