Skip to content

Commit

Permalink
Merge pull request #1 from botblock/node
Browse files Browse the repository at this point in the history
Add .editorconfig (botblock#24)
  • Loading branch information
drdrjojo committed Oct 9, 2019
2 parents 4c82140 + d6a0f25 commit 00bd57f
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 32 deletions.
36 changes: 36 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
# editorconfig-tools is unable to ignore longs strings or urls
max_line_length = off
trim_trailing_whitespace = true

[*.json]
indent_size = 2

[*.scss]
indent_size = 2

[*.yml]
indent_size = 2

# Don't enforce indent size on these types of files
[*.{md,txt}]
indent_size = none

# Ignored paths
[*.{psd,opts}]
charset = none
end_of_line = none
indent_size = none
indent_style = none
insert_final_newline = none
trim_trailing_whitespace = none

[db/seeds/data/*]
indent_size = none
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ about: Report a bug with the BotBlock.org website or API.

# Bug Report

## Description
## Description
<!-- Replace this with a brief summary of the bug. -->

## Steps to reproduce
Expand Down
8 changes: 4 additions & 4 deletions db/seeds/data/libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,22 @@
},
interval: 1000 * 30
});
client.on('beforePost', () => {
if (!bot.ready) return;
const serverCount = bot.guilds.size;
const shards = bot.shards.size;
client.update(serverCount, shards);
});
client.on('afterPost', (successful, failed) => {
console.log('Just finished posting to all bot lists, ' + successful + ' were successful, ' + failed + ' failed to post');
});
client.on('error', (error) => {
console.warn('Something happened', error);
});
client.start();
- repo: botblock/discordlists.py
language: Python
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"start": "node .",
"dev": "nodemon .",
"test": "mocha",
"lint:editorconfig": "editorconfig-checker",
"css:build": "node-sass --omit-source-map-url src/SCSS/style.scss src/Assets/css/style.min.css --output-style compressed",
"css:watch": "npm run css:build -- --watch",
"db:migrate": "knex migrate:latest",
Expand Down Expand Up @@ -46,6 +47,7 @@
},
"devDependencies": {
"bulma": "^0.7.5",
"editorconfig-checker": "^3.0.3",
"node-sass": "^4.12.0",
"nodemon": "^1.19.1"
}
Expand Down
2 changes: 1 addition & 1 deletion src/Assets/data-uri/question-mark-png.txt

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions src/Assets/geometry/readme.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@


========================================================
This pattern is downloaded from www.subtlepatterns.com
This pattern is downloaded from www.subtlepatterns.com
If you need more, that's where to get'em.
========================================================


========================================================
2 changes: 1 addition & 1 deletion src/Assets/img/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/Assets/js/checkboxes/hidden.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ window.addEventListener("load", function (event) {
elm.innerText = "Show All";
}
};
});
});
2 changes: 1 addition & 1 deletion src/Assets/js/checkboxes/interactive.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ window.addEventListener("load", function (event) {
handleClick(thiselm);
};
});
});
});
38 changes: 19 additions & 19 deletions src/Routes/Authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,27 +38,27 @@ class AuthenticationRoute extends BaseRoute {
'&redirect_uri=' + req.protocol + '://' + req.get('Host') + '/auth/callback' +
'&scope=' + config.discord.scopes.join(' ')
}).then((token) => {
axios({
method: 'GET',
url: 'https://discordapp.com/api/users/@me',
headers: {
Authorization: token.data.token_type + ' ' + token.data.access_token
}
}).then((user) => {
data = { ...user.data, ...token.data };
this.client.getMember(config.discord.guild_id, user.data.id).then((member) => {
if (member.roles.includes(config.discord.admin_role)) data.admin = true;
if (member.roles.includes(config.discord.mod_role)) data.mod = true;
}).catch((_) => {
axios({
method: 'GET',
url: 'https://discordapp.com/api/users/@me',
headers: {
Authorization: token.data.token_type + ' ' + token.data.access_token
}
}).then((user) => {
data = { ...user.data, ...token.data };
this.client.getMember(config.discord.guild_id, user.data.id).then((member) => {
if (member.roles.includes(config.discord.admin_role)) data.admin = true;
if (member.roles.includes(config.discord.mod_role)) data.mod = true;
}).catch((_) => {
data.admin = false;
data.mod = false;
}).finally(() => {
req.session.user = data;
res.redirect('/');
})
}).catch(() => {
res.status(400).json({ error: true, status: 400, message: 'Failed to get user information' });
})
}).finally(() => {
req.session.user = data;
res.redirect('/');
})
}).catch(() => {
res.status(400).json({ error: true, status: 400, message: 'Failed to get user information' });
})
}).catch(() => {
res.status(400).json({ error: true, status: 400, message: 'Failed to get token' });
})
Expand Down
14 changes: 14 additions & 0 deletions test/editorconfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const { describe, it } = require('./base');
const path = require('path');
const exec = require('child_process').exec;

describe('editorconfig', () => {
it('should follow editorconfig conventions', function (done) {
this.retries(0);
this.slow(2000);
exec('npm run lint:editorconfig', { cwd: path.join(__dirname, '..') }, (err, stdout) => {
if (err) return done(new Error(stdout));
done();
});
});
});

0 comments on commit 00bd57f

Please sign in to comment.