Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
chore: jest, eslint template setup
Browse files Browse the repository at this point in the history
  • Loading branch information
mubaidr committed Dec 5, 2019
1 parent 0488fca commit fbb8a68
Show file tree
Hide file tree
Showing 29 changed files with 11,934 additions and 258 deletions.
16 changes: 16 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"plugins": [
"@babel/proposal-object-rest-spread",
"@babel/plugin-proposal-class-properties"
],
"presets": [
[
"@babel/env",
{
"targets": {
"node": "current"
}
}
]
]
}
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# http://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

[*.md]
max_line_length = 0
trim_trailing_whitespace = false
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
"prettier/@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2019,
// "extraFileExtensions": [".vue"],
"parser": "babel-eslint",
"project": "./tsconfig.json",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/no-explicit-any": 0
}
}
3 changes: 3 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Example Contributing Guidelines

This is an example of GitHub's contributing guidelines file. Check out GitHub's [CONTRIBUTING.md help center article](https://help.github.com/articles/setting-guidelines-for-repository-contributors/) for more information.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* **I'm submitting a ...**
[ ] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project

* **Summary**



* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
* **What kind of change does this PR introduce?** (Bug fix, feature, docs update, ...)



* **What is the current behavior?** (You can also link to an open issue here)



* **What is the new behavior (if this is a feature change)?**



* **Other information**:
64 changes: 7 additions & 57 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,61 +1,11 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
node_modules
build
test
src/**.js
.idea/*

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output
*.log

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
yarn.lock
14 changes: 14 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
src
test
tsconfig.json
tsconfig.module.json
tslint.json
.travis.yml
.github
.prettierignore
.vscode
build/docs
**/*.spec.*
coverage
.nyc_output
*.log
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# package.json is formatted by package managers, so we ignore it here
package.json
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sudo: false
language: node_js
node_js:
- "10"
- "12"
# keep the npm cache to speed up installs
cache:
directories:
- "$HOME/.npm"
after_success:
- npm run cov:send
- npm run cov:check
52 changes: 52 additions & 0 deletions .vscode/debug-ts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
'use strict';
const meow = require('meow');
const path = require('path');

const tsFile = getTSFile();
const jsFile = TS2JS(tsFile);

replaceCLIArg(tsFile, jsFile);

// Ava debugger
require('ava/profile');

/**
* get ts file path from CLI args
*
* @return string path
*/
function getTSFile() {
const cli = meow();
return cli.input[0];
}

/**
* get associated compiled js file path
*
* @param tsFile path
* @return string path
*/
function TS2JS(tsFile) {
const srcFolder = path.join(__dirname, '..', 'src');
const distFolder = path.join(__dirname, '..', 'build', 'main');

const tsPathObj = path.parse(tsFile);

return path.format({
dir: tsPathObj.dir.replace(srcFolder, distFolder),
ext: '.js',
name: tsPathObj.name,
root: tsPathObj.root
});
}

/**
* replace a value in CLI args
*
* @param search value to search
* @param replace value to replace
* @return void
*/
function replaceCLIArg(search, replace) {
process.argv[process.argv.indexOf(search)] = replace;
}
39 changes: 39 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"version": "0.2.0",
"configurations": [{
"type": "node",
"request": "launch",
"name": "Debug Project",
// we test in `build` to make cleanup fast and easy
"cwd": "${workspaceFolder}/build",
// Replace this with your project root. If there are multiple, you can
// automatically run the currently visible file with: "program": ${file}"
"program": "${workspaceFolder}/src/cli/cli.ts",
// "args": ["--no-install"],
"outFiles": ["${workspaceFolder}/build/main/**/*.js"],
"skipFiles": [
"<node_internals>/**/*.js",
"${workspaceFolder}/node_modules/**/*.js"
],
"preLaunchTask": "npm: build",
"stopOnEntry": true,
"smartStep": true,
"runtimeArgs": ["--nolazy"],
"env": {
"TYPESCRIPT_STARTER_REPO_URL": "${workspaceFolder}"
},
"console": "externalTerminal"
},
{
"type": "node",
"request": "launch",
"name": "Debug Spec",
"program": "${workspaceRoot}/.vscode/debug-ts.js",
"args": ["${file}"],
"skipFiles": ["<node_internals>/**/*.js"],
// Consider using `npm run watch` or `yarn watch` for faster debugging
// "preLaunchTask": "npm: build",
// "smartStep": true,
"runtimeArgs": ["--nolazy"]
}]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
// "typescript.implementationsCodeLens.enabled": true
// "typescript.referencesCodeLens.enabled": true
}
Loading

0 comments on commit fbb8a68

Please sign in to comment.