chore: update

This commit is contained in:
Anthony Fu committed 2020-01-19 14:16:41 +00:00
1 parent 96cafcb4e7
commit f141c019cb
15 files changed
+9170 -187

No files matched your search

-19
View File
@@ -1,19 +0,0 @@
# editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.{xml,xsd}]
max_line_length = off
end_of_line = lf
indent_style = space
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_size = 2
+2
View File
@@ -0,0 +1,2 @@
dist
typings
+5 -84
View File
@@ -5,91 +5,12 @@ module.exports = {
browser: true,
node: true,
},
plugins: [
'@typescript-eslint',
],
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'@antfu/eslint-config-ts',
],
plugins: [
'jest',
],
// add your custom rules here
rules: {
'semi': [2, 'never'],
'curly': [2, 'multi-or-nest', 'consistent'],
'quotes': ['error', 'single'],
'no-unused-vars': 'warn',
'no-param-reassign': 'off',
'brace-style': ['error', 'stroustrup', { 'allowSingleLine': true }],
'array-bracket-spacing': ['error', 'never'],
'block-spacing': ['error', 'always'],
'camelcase': 'off',
'comma-spacing': ['error', { before: false, after: true }],
'comma-style': ['error', 'last'],
'comma-dangle': ['error', 'always-multiline'],
'no-console': 'warn',
'no-constant-condition': 'warn',
'no-debugger': 'error',
'no-cond-assign': ['error', 'always'],
'func-call-spacing': ['off', 'never'],
'key-spacing': ['error', { beforeColon: false, afterColon: true }],
'indent': ['error', 2, { SwitchCase: 1, VariableDeclarator: 1, outerIIFEBody: 1 }],
'no-restricted-syntax': [
'error',
'DebuggerStatement',
'ForInStatement',
'LabeledStatement',
'WithStatement',
],
'no-spaced-func': 'error',
'object-curly-spacing': ['error', 'always'],
'no-return-await': 'off',
// es6
'arrow-spacing': ['error', { before: true, after: true }],
'no-var': 'error',
'prefer-const': ['error', {
destructuring: 'any',
ignoreReadBeforeAssign: true,
}],
'prefer-arrow-callback': ['error', {
allowNamedFunctions: false,
allowUnboundThis: true,
}],
'object-shorthand': ['error', 'always', {
ignoreConstructors: false,
avoidQuotes: true,
}],
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'prefer-template': 'error',
'template-curly-spacing': 'error',
// best-practice
'array-callback-return': 'error',
'block-scoped-var': 'error',
'consistent-return': 'off',
'complexity': ['off', 11],
'eqeqeq': ['error', 'allow-null'],
'no-alert': 'warn',
'no-case-declarations': 'error',
'no-multi-spaces': 'error',
'no-multi-str': 'error',
'no-with': 'error',
'no-void': 'error',
'no-useless-escape': 'error',
'vars-on-top': 'error',
'require-await': 'off',
'no-return-assign': 'off',
'operator-linebreak': [2, 'before'],
// TS
'@typescript-eslint/no-unused-vars': [2, { args: 'none' }],
'@typescript-eslint/indent': ['error', 2],
'@typescript-eslint/member-delimiter-style': ['error', { multiline: { delimiter: 'none' } }],
'@typescript-eslint/type-annotation-spacing': ['error', {}],
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off',
'@typescript-eslint/no-explicit-any': 'off',
}
},
}
+24
View File
@@ -0,0 +1,24 @@
name: Test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Install
run: npm ci
- name: Lint
run: npm run lint
- name: Test
run: npm test
-41
View File
@@ -1,43 +1,2 @@
{
// Basic
"search.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/bower_components": true,
"**/tmp": true,
"**/dist": true,
"**/logs": true,
"**/package-lock.json": true,
},
"editor.tabSize": 2,
"editor.renderWhitespace": "boundary",
"editor.formatOnPaste": true,
"editor.formatOnSave": false,
"[json]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "vscode.json-language-features"
},
"[xml]": {
"editor.formatOnSave": true
},
// Eslint
"eslint.autoFixOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
{
"language": "typescript",
"autoFix": true
},
{
"language": "vue",
"autoFix": true
},
{
"language": "html",
"autoFix": true
}
],
}
-3
View File
@@ -1,3 +0,0 @@
(async () => {
})()
+12
View File
@@ -0,0 +1,12 @@
module.exports = {
roots: [
'<rootDir>/test',
],
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/?(*.)+(spec|test).+(ts|tsx|js)',
],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
}
+9016
View File
File diff suppressed because it is too large. Load diff
+44 -21
View File
@@ -1,31 +1,54 @@
{
"name": "ts-node-starter",
"version": "1.0.0",
"version": "0.0.1",
"description": "",
"main": "index.js",
"main": "dist/index.js",
"scripts": {
"start": "ts-node ./index.ts",
"dev": "nodemon -w . --exec 'ts-node' ./index.ts"
"dev": "rollup -c --watch",
"build": "npm run typings && rollup -c",
"typings": "tsc --emitDeclarationOnly",
"publish:ci": "npm run build && npm publish --access public",
"release": "bump --commit --push --tag && npm run publish:ci",
"lint": "eslint src/**/*.ts",
"lint:fix": "npm run lint -- --fix",
"test": "jest"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{ts,js}": [
"eslint --fix",
"git add"
]
},
"files": [
"dist"
],
"keywords": [],
"author": "",
"author": "Anthony Fu<anthonyfu117@hotmail.com>",
"license": "MIT",
"dependencies": {
"ts-node": "^8.3.0",
"typescript": "^3.5.2",
"ts-optchain": "^0.1.7"
},
"dependencies": {},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^1.10.2",
"@typescript-eslint/parser": "^1.10.2",
"eslint": "^5.16.0",
"eslint-config-standard": "^12.0.0",
"eslint-loader": "^2.1.2",
"eslint-plugin-import": "^2.17.3",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-promise": "^4.1.1",
"eslint-plugin-standard": "^4.0.0",
"nodemon": "^1.19.1",
"rimraf": "^2.6.3"
"@antfu/eslint-config-ts": "0.2.10",
"@rollup/plugin-json": "4.0.1",
"@rollup/plugin-typescript": "2.1.0",
"@types/jest": "24.9.0",
"@types/node": "13.1.8",
"eslint": "6.8.0",
"eslint-plugin-jest": "23.6.0",
"husky": "4.0.10",
"jest": "^24.9.0",
"lint-staged": "9.5.0",
"nodemon": "2.0.2",
"rimraf": "3.0.0",
"rollup": "1.29.0",
"rollup-plugin-dts": "1.2.0",
"rollup-plugin-uglify": "6.0.4",
"ts-jest": "24.3.0",
"ts-node": "8.6.2",
"typescript": "3.7.5"
}
}
+2 -1
View File
@@ -11,5 +11,6 @@
"group:allNonMajor"
],
"commitMessageAction": "Update"
}
},
"automerge": true
}
+36
View File
@@ -0,0 +1,36 @@
// rollup.config.js
import typescript from '@rollup/plugin-typescript'
import json from '@rollup/plugin-json'
import dts from 'rollup-plugin-dts'
import { uglify } from 'rollup-plugin-uglify'
const external = [
]
export default [
{
input: 'src/index.ts',
output: [
{
file: 'dist/index.js',
format: 'cjs',
},
],
plugins: [
typescript(),
json(),
uglify(),
],
external,
},
{
input: './typings/index.d.ts',
output: {
file: 'dist/index.d.ts',
format: 'es',
},
plugins: [
dts(),
],
},
]
+1
View File
@@ -0,0 +1 @@
export * from './number'
+2
View File
@@ -0,0 +1,2 @@
export const one = 1
export const two = 2
+7
View File
@@ -0,0 +1,7 @@
import { one } from '../src'
describe('should', () => {
it('exported', () => {
expect(one).toEqual(1)
})
})
+19 -18
View File
@@ -1,32 +1,33 @@
{
"compilerOptions": {
"baseUrl": ".",
"esModuleInterop": true,
"experimentalDecorators": true,
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"noEmit": true,
"noImplicitAny": false,
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"target": "es2017",
"lib": [
"esnext",
"esnext.asynciterable",
"dom",
"dom.iterable"
],
"paths": {
"~/*": ["./*"],
"@/*": ["./*"],
},
"esModuleInterop": true,
"strict": true,
"declaration": true,
"resolveJsonModule": true,
"declarationDir": "./typings",
"types": [
"@types/node",
],
"plugins": [
{ "transform": "ts-optchain/transform" },
],
"@types/jest"
]
},
"include": [
"**/*.ts",
"src"
],
"exclude": [
"node_modules",
"**/**/*.test.ts",
"**/**/*.md",
"test",
"typings",
"dist"
]
}