Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Improve Developer Ergonomics #10

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
continuation_indent_size = 2
indent_size = 2

[*.md]
trim_trailing_whitespace = false
File renamed without changes.
75 changes: 75 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
module.exports = {
"extends": [
"eslint:all",
"airbnb-base",
"plugin:node/recommended"
],
"env": {
"es6": true,
"browser": false,
"node": true
},
//"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module"
},
"plugins" : [
"node"
],
"settings": {
},
"rules": {
"arrow-spacing" : [2, {"before": true, "after": true}],
"camelcase" : [2, {"properties": "never"}],
"comma-dangle" : [2, "never"],
"comma-spacing" : [2, {"before": false, "after": true}],
"constructor-super" : 2,
"curly" : 2,
"dot-location" : [2, "property"],
"eol-last" : 2,
"eqeqeq" : [2, "allow-null"],
"func-names" : [2, "never"],
"func-style" : [2, "expression", {"allowArrowFunctions": true}],
"id-blacklist" : [2, "moment"],
"indent" : [2, 2, {"SwitchCase": 1}],
"linebreak-style" : [2, "unix"],
"max-len" : [2, {"code": 120, "comments": 120}],
"no-class-assign" : 2,
"no-console" : 1,
"no-const-assign" : 2,
"no-extra-bind" : 2,
"no-extra-parens" : 2,
"no-func-assign" : 2,
"no-implicit-globals" : 2,
"no-invalid-this" : 2,
"no-lonely-if" : 2,
"no-magic-numbers" : [2, { "ignore": [0, 1] }],
"no-multi-spaces" : 2,
"no-multi-str" : 2,
"no-new-symbol" : 2,
"no-self-assign" : 2,
"no-shadow" : 2,
"no-spaced-func" : 2,
"no-this-before-super" : 2,
"no-trailing-spaces" : 2,
"no-unreachable" : 2,
"no-unused-vars" : [2, { "argsIgnorePattern": "^_" }],
"no-useless-concat" : 2,
"no-useless-constructor" : 2,
"no-var" : 2,
"no-whitespace-before-property" : 2,
"object-curly-spacing" : [2, "always"],
"object-shorthand" : 2,
"operator-linebreak" : [2, "before"],
"prefer-const" : 2,
"prefer-spread" : 2,
"prefer-template" : 2,
"quotes" : [2, "single"],
"semi" : [2, "always"],
"space-before-blocks" : 2,
"space-before-function-paren" : [2, "never"],
"space-infix-ops" : [2],
"strict" : 2
}
};
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.env
.db
node_modules
components/routes/_*
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v6.10.2
1 change: 1 addition & 0 deletions bot.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require('./build-support/check-node-version');
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
______ ______ ______ __ __ __ ______
/\ == \ /\ __ \ /\__ _\ /\ \/ / /\ \ /\__ _\
Expand Down
18 changes: 18 additions & 0 deletions build-support/check-node-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const fs = require('fs');
const path = require('path');

const checkNodeVersion = function() {
const rootDir = path.resolve(__dirname, '../');
const nvmrcVersion = fs.readFileSync(path.join(rootDir, '.nvmrc'), 'utf8').trim();
const { version } = process;
if (version !== nvmrcVersion) {
let errorMsg = `NODE VERSION ERROR: The required node version, "${nvmrcVersion}", `;
errorMsg += `does not match the system version, "${version}"`;
throw new Error(errorMsg);
} else {
// eslint-disable-next-line no-console
console.log(`NODE VERSION: "${nvmrcVersion}"`);
}
};

checkNodeVersion();
13 changes: 13 additions & 0 deletions build-support/force-yarn-package-management.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const checkYarnInstall = function() {
console.log('process.env.npm_execpath: ', process.env.npm_execpath);
const isUsingYarn = process.env.npm_execpath.includes('yarn');
/* eslint-disable no-console */
console.log(`Using yarn: ${isUsingYarn}`);
console.log(` (npm_execpath: "${process.env.npm_execpath}")\n`);
/* eslint-enable no-console */
if (!isUsingYarn) {
throw new Error('You must use Yarn to install dependencies, not NPM');
}
};

checkYarnInstall();
19 changes: 17 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{
"name": "botkit-starter-slack",
"engines": {
"node": "v6.10.2"
},
"version": "0.0.2",
"description": "A starter kit for building a custom Slack bot with Botkit Studio",
"main": "bot.js",
"scripts": {
"start": "node bot.js"
"preinstall": "node build-support/check-node-version.js && node build-support/force-yarn-package-management.js",
"start": "node bot.js",
"start:watch": "nodemon --debug bot.js",
"lint:js": "eslint .",
"lint:js:watch": "esw . -w --changed",
"lint:js:fix": "eslint . --fix"
},
"dependencies": {
"body-parser": "^1.15.2",
Expand All @@ -17,7 +25,14 @@
"request": "^2.79.0",
"wordfilter": "^0.2.6"
},
"devDependencies": {},
"devDependencies": {
"eslint": "^3.19.0",
"eslint-config-airbnb-base": "^11.1.3",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-node": "^4.2.2",
"eslint-watch": "^3.0.1",
"nodemon": "^1.11.0"
},
"repository": {
"type": "git",
"url": "https://github.com/howdyai/botkit-starter-slack.git"
Expand Down
Loading