Merge branch 'feature/5-add-eslint-to-gitlab-project-ci' into 'master'
Add aslant to gitlab project ci Closes #5 See merge request Vylpes/random-bunny!2
This commit is contained in:
commit
c57cf7831c
5 changed files with 538 additions and 5360 deletions
48
.eslintrc
Normal file
48
.eslintrc
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 6
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended"
|
||||
],
|
||||
"rules": {
|
||||
"camelcase": "error",
|
||||
"brace-style": [
|
||||
"error",
|
||||
"1tbs"
|
||||
],
|
||||
"comma-dangle": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"comma-spacing": [
|
||||
"error",
|
||||
{
|
||||
"before": false,
|
||||
"after": true
|
||||
}
|
||||
],
|
||||
"comma-style": [
|
||||
"error",
|
||||
"last"
|
||||
],
|
||||
"arrow-body-style": [
|
||||
"error",
|
||||
"as-needed"
|
||||
],
|
||||
"arrow-parens": [
|
||||
"error",
|
||||
"as-needed"
|
||||
],
|
||||
"arrow-spacing": "error",
|
||||
"no-var": "error",
|
||||
"prefer-template": "error"
|
||||
},
|
||||
"globals": {
|
||||
"exports": "writable",
|
||||
"module": "writable",
|
||||
"require": "writable",
|
||||
"process": "writable",
|
||||
"console": "writable"
|
||||
}
|
||||
}
|
10
.gitlab-ci.yml
Normal file
10
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
image: node
|
||||
|
||||
stages:
|
||||
- lint
|
||||
|
||||
eslint:
|
||||
stage: lint
|
||||
script:
|
||||
- npm install
|
||||
- npm run lint
|
7
index.js
7
index.js
|
@ -1,6 +1,6 @@
|
|||
const fetch = require('node-fetch');
|
||||
|
||||
sortable = [
|
||||
const sortable = [
|
||||
'new',
|
||||
'hot',
|
||||
'top'
|
||||
|
@ -14,9 +14,6 @@ function randomBunny(subreddit, sortBy, cb) {
|
|||
const data = res.data.children;
|
||||
const size = data.length;
|
||||
|
||||
const random = getRandom(0, size - 1);
|
||||
|
||||
const image = data[random];
|
||||
let found = false;
|
||||
|
||||
while (!found) {
|
||||
|
@ -38,4 +35,4 @@ function getRandom(min, max) {
|
|||
return Math.floor((Math.random() * max) + min);
|
||||
}
|
||||
|
||||
module.exports = randomBunny;
|
||||
module.exports = randomBunny;
|
||||
|
|
5826
package-lock.json
generated
5826
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -17,9 +17,12 @@
|
|||
"node-fetch": "^2.6.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"No tests\""
|
||||
"lint": "eslint ."
|
||||
},
|
||||
"bugs": "https://gitlab.vylpes.com/Vylpes/random-bunny/-/issues",
|
||||
"homepage": "https://gitlab.vylpes.com/Vylpes/random-bunny",
|
||||
"funding": "https://ko-fi.com/gravitysoftware"
|
||||
"funding": "https://ko-fi.com/gravitysoftware",
|
||||
"devDependencies": {
|
||||
"eslint": "^7.17.0"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue