Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomaash committed Oct 4, 2019
0 parents commit 17ec2fa
Show file tree
Hide file tree
Showing 28 changed files with 7,583 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": "maintained node versions",
"useBuiltIns": "usage",
"corejs": 3
}
],
"@babel/preset-typescript"
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
]
}
121 changes: 121 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2.1

executors:
node:
docker:
- image: circleci/node:12.7
working_directory: ~/repo
environment:
GIT_AUTHOR_EMAIL: [email protected]
GIT_AUTHOR_NAME: vis-bot
GIT_COMMITTER_EMAIL: [email protected]
GIT_COMMITTER_NAME: vis-bot

jobs:
prepare:
executor: node

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: npm ci

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

- persist_to_workspace:
root: .
paths:
- '*'

build:
executor: node

steps:
- attach_workspace:
at: .

- run: npm run build

- persist_to_workspace:
root: .
paths:
- 'bin'

lint:
executor: node

steps:
- attach_workspace:
at: .

- run: npm run lint

test:
executor: node

steps:
- attach_workspace:
at: .

- run: npm run test

release:
executor: node

steps:
- attach_workspace:
at: .

- run:
name: Prepare NPM
command: |
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
- run:
name: Release
command: |
npx semantic-release
workflows:
version: 2

build:
jobs:
- prepare

- build:
requires:
- prepare

- lint:
requires:
- prepare

- test:
requires:
- prepare

- release:
requires:
- prepare
- build
- lint
- test
filters:
branches:
only:
- master
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
!/.eslintrc
/bin
/dist
97 changes: 97 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
module.exports = {
env: {
browser: false,
es6: true,
node: true,
mocha: true
},

parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
ecmaVersion: 2019,
project: "tsconfig.json"
},

plugins: ["prettier", "@typescript-eslint"],

extends: ["eslint:recommended", "prettier"],

// JavaScript
rules: {
"prettier/prettier": ["error"],

complexity: ["error", 55],
"max-statements": ["error", 115],
"no-unreachable": "error",
"no-useless-escape": "off",

"no-console": ["error", { allow: ["info", "warn", "error"] }],

"valid-jsdoc": [
"error",
{
requireReturnDescription: false,
requireReturn: false,
requireParamDescription: false,
requireReturnType: true
}
],
"guard-for-in": 1
},
overrides: [
// TypeScript
{
files: ["**/*.ts", "**/*.d.ts"],
rules: {
// @TODO: Seems to mostly work just fine but I'm not 100 % sure.
// @TODO: Deprecated, anything like this for tsdoc?
"valid-jsdoc": [
"warn",
{
prefer: {
arg: "param",
argument: "param",
return: "returns"
},
requireParamDescription: true,
requireParamType: false,
requireReturn: false, // Requires return for void functions.
requireReturnDescription: true,
requireReturnType: false
}
],

// Class related.
"@typescript-eslint/member-naming": [
"error",
{ private: "^_", protected: "^_", public: "^[^_]" }
],
"@typescript-eslint/no-parameter-properties": "off",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/prefer-readonly": "error",

// Other.
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-regexp-exec": "error",
// @TODO: Seems like a good thing, not yet on npm though.
// "@typescript-eslint/require-await": "error",

// These are hoisted, I have no idea why it reports them by default.
"@typescript-eslint/no-use-before-define": [
"error",
{ functions: false, classes: false, typedefs: false }
],
// False positives for overloading, also tsc compiles with errors anyway.
"no-dupe-class-members": "off",
// Blocks typesafe exhaustive switch (switch (x) { … default: const never: never = x }).
"no-case-declarations": "off",
// Reports used types.
"no-unused-vars": "off",
// Reports typeof bigint as an error, tsc validates this anyway so no problem turning this off.
"valid-typeof": "off"
}
}
]
};
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# npm files
/node_modules
/npm-debug.log

# ide or system files
/.idea
/.c9
/*.iml
/.project
/.settings
/.directory

# temporary files
/.*.sw[op]
/.commits.tmp
/gen
/.nyc_output
/coverage
/.rpt2_cache

# built files
/bin
/dist
/vis-dev-util-0.0.0-no-version.tgz
4 changes: 4 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"**/*.{js,ts}": ["eslint --fix", "git add"],
"**/*.{css,html,js,json,ts}": ["prettier --write", "git add"]
}
6 changes: 6 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extension": ["js", "ts"],
"require": ["./babel.require.js"],
"spec": ["./test/**/*.test.*"],
"watch-files": ["./src/**/*", "./test/**/*"]
}
1 change: 1 addition & 0 deletions .prettierignore
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
6 changes: 6 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
branch: master
plugins:
- '@semantic-release/commit-analyzer'
- '@semantic-release/release-notes-generator'
- '@semantic-release/npm'
- '@semantic-release/github'
9 changes: 9 additions & 0 deletions @types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
declare module "*.css" {
const value: string;
export default value;
}

declare module "*.html" {
const value: string;
export default value;
}
Loading

0 comments on commit 17ec2fa

Please sign in to comment.