add .pre-commit-config.yaml & run prettify

This commit is contained in:
Aminda Suomalainen 2023-02-22 13:07:21 +02:00
parent 32d843fc27
commit 848e951ac6
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q
3 changed files with 47 additions and 23 deletions

26
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,26 @@
# Remember to run `pre-commit install` at least once!
# Manual test run: `pre-commit run --all-files`
# Update? `pre-commit autoupdate`
#
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
- id: destroyed-symlinks
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.0-alpha.4"
hooks:
- id: prettier
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: "2.7.1"
hooks:
- id: editorconfig-checker
alias: ec

View File

@ -11,12 +11,12 @@ through curl/wget.
### Directories
* *bash* has just normal bash scripts
* *nodejs* **MIGHT** get some nodejs scripts
* *WeeChat* is a placeholder and unlikely to get anything.
* *ZNC* is another placeholder which is unlikely to get anything.
* note that they are *modules* with ZNC, but I don't see why I
couldn't put them here.
- _bash_ has just normal bash scripts
- _nodejs_ **MIGHT** get some nodejs scripts
- _WeeChat_ is a placeholder and unlikely to get anything.
- _ZNC_ is another placeholder which is unlikely to get anything.
- note that they are _modules_ with ZNC, but I don't see why I
couldn't put them here.
*I doubt I am going to write many WeeChat scripts or ZNC modules, so I
won't be making subdirectories for different languages.*
_I doubt I am going to write many WeeChat scripts or ZNC modules, so I
won't be making subdirectories for different languages._

View File

@ -1,26 +1,24 @@
#!/usr/bin/env node
// Require the dns module
var dns = require('dns');
var dns = require("dns");
// Function for IPv4
var myip4 = function () {
// Set DNS servers to OpenDNS IPv4
var servers4 = dns.setServers(["208.67.222.222", "208.67.220.220"])
// Set DNS servers to OpenDNS IPv4
var servers4 = dns.setServers(["208.67.222.222", "208.67.220.220"]);
// Check where myip.opendns.com resolves to and I think this is a
// function that takes arguments err and addresses.
dns.resolve4('myip.opendns.com', function (err, addresses) {
// Check where myip.opendns.com resolves to and I think this is a
// function that takes arguments err and addresses.
dns.resolve4("myip.opendns.com", function (err, addresses) {
// if err contains a truthy value, an error has occurred
if (err) throw err;
// if err contains a truthy value, an error has occurred
if (err) throw err;
// Print the first thing in array addresses as it has our IPv4
// address.
console.log(addresses[0]);
});
}
// Print the first thing in array addresses as it has our IPv4
// address.
console.log(addresses[0]);
});
};
// IPv6 part is broken because of node bug.
// https://github.com/nodejs/node/issues/894