Skip to content

Commit

Permalink
refactor: rewrite by typescript
Browse files Browse the repository at this point in the history
fix #6
  • Loading branch information
Val-istar-Guo committed May 9, 2021
1 parent d59f9d6 commit fe568dd
Show file tree
Hide file tree
Showing 44 changed files with 523 additions and 184 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

1 change: 0 additions & 1 deletion .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# mili upgrade type: cover
extends:
- '@commitlint/config-conventional'
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Dist
/lib
/es
175 changes: 175 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
extends:
- eslint:recommended
- plugin:@typescript-eslint/eslint-recommended
- plugin:@typescript-eslint/recommended
plugins:
- '@typescript-eslint'
parserOptions:
project:
- ./tsconfig.json
- ./tests/tsconfig.json
ecmaVersion: 6
sourceType: module
env:
es6: true
node: true
rules:
func-call-spacing: off
no-unused-vars: off
require-atomic-updates: off
eqeqeq: error
no-floating-decimal: error
no-var: error
no-implicit-coercion: error
no-multi-spaces: error
no-useless-return: error
no-undef-init: error
no-trailing-spaces: error
no-unneeded-ternary: error
no-whitespace-before-property: error
nonblock-statement-body-position: error
space-infix-ops: error
space-unary-ops: error
switch-colon-spacing: error
arrow-body-style: error
arrow-spacing: error
generator-star-spacing: error
no-useless-computed-key: error
no-useless-rename: error
new-cap: error
no-lonely-if: error
no-console: off
multiline-comment-style: off
object-shorthand: error
prefer-const: error
prefer-spread: error
prefer-template: error
rest-spread-spacing: error
sort-imports: off
template-curly-spacing: error
yield-star-spacing: error
yoda:
- error
- never
curly:
- error
- multi-line
- consistent
semi: off
quotes:
- error
- single
- avoidEscape: true
dot-location:
- error
- property
array-bracket-spacing:
- error
- never
array-bracket-newline:
- error
- consistent
block-spacing:
- error
- always
brace-style:
- error
- 1tbs
comma-dangle:
- error
- always-multiline
comma-style:
- error
- last
computed-property-spacing:
- error
- never
function-paren-newline:
- error
- multiline
implicit-arrow-linebreak:
- error
- beside
indent: off
key-spacing:
- error
- afterColon: true
beforeColon: false
mode: strict
keyword-spacing:
- error
- before: true
after: true
line-comment-position:
- error
- above
linebreak-style:
- error
- unix
lines-between-class-members:
- error
- always
- exceptAfterSingleLine: true
no-multiple-empty-lines:
- error
- max: 2
no-empty:
- error
- allowEmptyCatch: true
object-curly-newline:
- error
- multiline: true
consistent: true
object-curly-spacing:
- error
- always
one-var-declaration-per-line:
- error
- initializations
padded-blocks:
- error
- never
quote-props:
- error
- as-needed
space-before-blocks:
- error
- always
space-before-function-paren:
- error
- never
space-in-parens:
- error
- never
spaced-comment:
- error
- always
arrow-parens:
- error
- as-needed
'@typescript-eslint/semi':
- error
- never
'@typescript-eslint/indent':
- error
- 2
'@typescript-eslint/explicit-function-return-type':
- error
- allowHigherOrderFunctions: true
allowExpressions: true
allowTypedFunctionExpressions: true
'@typescript-eslint/member-delimiter-style':
- error
- multiline:
delimiter: none
'@typescript-eslint/no-unused-vars': error
'@typescript-eslint/func-call-spacing':
- error
- never
'@typescript-eslint/ban-ts-comment': off
'@typescript-eslint/explicit-member-accessibility':
- error
- overrides:
accessors: off
constructors: off
properties: no-public
12 changes: 12 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# These are supported funding model platforms

github:
patreon: val_istar_guo
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 changes: 9 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
name: Bug report
about: Create a report to help us improve
title: 'bug: '
labels: bug
assignees: val-istar-guo

---
<!-- Please delete unused section -->
Expand All @@ -19,10 +22,12 @@ Steps to reproduce the behavior:
A clear and concise description of what you expected to happen.

**Platform (please complete the following information):**
- Device: [e.g. Mac, Windows, iPhone6]
- OS: [e.g. iOS8.2]
- Environment: [e.g. nodejs, chrome, safari]
- Version [e.g. 6.1.2]

<!-- '-' mean no value -->
- Device: - <!-- e.g. [-, Mac, Windows, iPhone6] -->
+ OS: - <!-- e.g. [-, iOS8.2] -->
- Environment: NodeJS <!-- e.g. [-, nodejs, chrome, safari] -->
+ Version: <!-- e.g. [6.1.2] -->

**Additional context**
Add any other context about the problem here.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/docs_improve.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
name: Document improve
about: Improve document quality or improve document content
title: 'docs: '
assignees: val-istar-guo

---
<!-- Please delete unused section -->
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
name: Feature request
about: Suggest an idea for this project
title: 'feat: '
assignees: val-istar-guo

---
<!-- Please delete unused section -->
Expand Down
10 changes: 3 additions & 7 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
**IMPORTANT: Please do not create a Pull Request without creating an issue first.**
Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.
<!-- IMPORTANT: Please do not create a Pull Request without creating an issue first -->
<!-- Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request. -->


**Close issues**
List the issues solved.(e.g. 'close #xxx, close #xxx and close #xxx')


**Additional context**
Please provide enough information so that others can review your pull request.


**Please check if the PR fulfills these requirements**

- [ ] Have you followed the guidelines in our [Contributing document](https://github.com/Val-istar-Guo/mili/blob/master/.github/CODE_OF_CONDUCT.md)?
- [ ] Have you written new tests for your core changes, as applicable?
- [ ] Have you successfully ran tests with your changes locally?
- [ ] Have you written or modified docs for your core changes, as applicable?
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on:
push:
branches:
- master
- main
name: release
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v2
id: release
with:
release-type: node
package-name: "koa-csp"
- uses: actions/checkout@v2
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v1
with:
node-version: 14
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created }}
- run: npm i
if: ${{ steps.release.outputs.release_created }}
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.release_created }}
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# mili upgrade type: cover
# Mac
.DS_Store

# Node
node_modules

# Error Log
npm-debug.log*
yarn-error.log

# Complie
/lib
/es
dist/

# Editor
Expand All @@ -20,3 +24,6 @@ yarn.lock
# Test
coverage
.nyc_output

# mili upgrade type: cover

1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
6 changes: 6 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm test
npx --no-install lint-staged
npx --no-install mili check --diff --no-deps --ignore "**/node_modules"
4 changes: 0 additions & 4 deletions .huskyrc.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .lintstagedrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'**/*.{ts}':
- 'eslint --fix'
- 'git add'
13 changes: 10 additions & 3 deletions .milirc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
repository: https://github.com/Val-istar-Guo/component-template.git
version: 0.4.0
mili:
version: 1.6.0
version: 3.10.2
template:
repository: 'npm:@mtpl/component'
version: 2.16.1
answers:
ci: true
standardVersion: true
lint: true
lock: false
module: umd
24 changes: 21 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,35 @@
.DS_Store
/demo
/docs
/templates
/tests
/src
node_modules
.github
.nyc_output
.vscode
.DS_Store

# Dev Config File
.commitlintrc.yml
.czrc
.eslintrc.yml
.gitignore
.huskyrc.yml
.lintstagedrc.yml
.travis.yml
ava.config.js
rollup.config.js
tsconfig.json

# Error Log
npm-debug.log*
yarn-error.log

# Config File
.gitignore
.eslintrc.json
.eslintignore
.editorconfig
.babelrc
rollup.config.js
yarn.lock

# Test File
Expand Down
Loading

0 comments on commit fe568dd

Please sign in to comment.