-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
335 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# EditorConfig | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = crlf | ||
insert_final_newline = true | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
coverage | ||
test/temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"commonjs": true, | ||
"es6": true, | ||
"mocha": true | ||
}, | ||
"extends": ["eslint:recommended", "plugin:prettier/recommended"], | ||
"parserOptions": { | ||
"ecmaVersion": 2019 | ||
}, | ||
"plugins": ["prettier"], | ||
"rules": { | ||
"prettier/prettier": "error", | ||
"no-await-in-loop": "warn", | ||
"accessor-pairs": "error", | ||
"array-callback-return": "error", | ||
"block-scoped-var": "error", | ||
"class-methods-use-this": "off", | ||
"curly": ["error", "all"], | ||
"default-case": "error", | ||
"dot-location": ["error", "property"], | ||
"eqeqeq": ["error", "always"], | ||
"guard-for-in": "error", | ||
"no-alert": "error", | ||
"no-caller": "error", | ||
"no-case-declarations": "error", | ||
"no-console": "off", | ||
"no-div-regex": "error", | ||
"no-else-return": "off", | ||
"no-empty-function": "error", | ||
"no-empty-pattern": "error", | ||
"no-eq-null": "error", | ||
"no-eval": "error", | ||
"no-extend-native": "error", | ||
"no-extra-bind": "error", | ||
"no-extra-label": "error", | ||
"no-floating-decimal": "error", | ||
"no-implicit-coercion": "error", | ||
"no-implicit-globals": "error", | ||
"no-invalid-this": "error", | ||
"no-iterator": "error", | ||
"no-labels": "error", | ||
"no-lone-blocks": "error", | ||
"no-loop-func": "error", | ||
"no-magic-numbers": "off", | ||
"no-multi-spaces": [ | ||
"error", | ||
{ | ||
"ignoreEOLComments": true | ||
} | ||
], | ||
"no-multi-str": "error", | ||
"no-new": "error", | ||
"no-new-func": "error", | ||
"no-new-wrappers": "error", | ||
"no-octal-escape": "error", | ||
"no-param-reassign": "error", | ||
"no-proto": "error", | ||
"no-restricted-properties": "error", | ||
"no-return-await": "off", | ||
"no-script-url": "error", | ||
"no-self-compare": "error", | ||
"no-sequences": "error", | ||
"no-throw-literal": "error", | ||
"no-unmodified-loop-condition": "error", | ||
"no-useless-call": "error", | ||
"no-useless-catch": "error", | ||
"no-useless-concat": "error", | ||
"no-useless-return": "error", | ||
"no-void": "error", | ||
"no-warning-comments": "error", | ||
"no-with": "error", | ||
"prefer-named-capture-group": "error", | ||
"prefer-promise-reject-errors": "error", | ||
"radix": "error", | ||
"require-await": "off", | ||
"require-unicode-regexp": "error", | ||
"yoda": ["error", "never"], | ||
|
||
"strict": ["error", "global"], | ||
|
||
"no-label-var": "error", | ||
"no-restricted-globals": "error", | ||
"no-shadow": "error", | ||
"no-undef-init": "error", | ||
"no-undefined": "error", | ||
"no-use-before-define": "error", | ||
"callback-return": "off", | ||
"global-require": "error", | ||
"handle-callback-err": "error", | ||
"no-buffer-constructor": "error", | ||
"no-mixed-requires": [ | ||
"error", | ||
{ | ||
"grouping": false, | ||
"allowCall": false | ||
} | ||
], | ||
"no-new-require": "error", | ||
"no-path-concat": "error", | ||
"no-process-env": "off", | ||
"no-process-exit": "error", | ||
|
||
"array-bracket-newline": ["error", "consistent"], | ||
"array-bracket-spacing": ["error", "never"], | ||
"array-element-newline": ["error", "consistent"], | ||
"block-spacing": ["error", "always"], | ||
"brace-style": ["error", "1tbs"], | ||
"camelcase": "off", | ||
"comma-spacing": [ | ||
"error", | ||
{ | ||
"before": false, | ||
"after": true | ||
} | ||
], | ||
"comma-style": ["error", "last"], | ||
"computed-property-spacing": ["error", "never"], | ||
"consistent-this": ["error", "self"], | ||
"eol-last": ["error", "always"], | ||
"func-call-spacing": ["error", "never"], | ||
"func-names": ["error", "always"], | ||
"function-paren-newline": ["error", "consistent"], | ||
"id-blacklist": ["error", "e", "cb"], | ||
"implicit-arrow-linebreak": ["error", "beside"], | ||
"indent": ["error", 2], | ||
"key-spacing": [ | ||
"error", | ||
{ | ||
"beforeColon": false, | ||
"afterColon": true | ||
} | ||
], | ||
"keyword-spacing": "error", | ||
"line-comment-position": [ | ||
"error", | ||
{ | ||
"position": "above" | ||
} | ||
], | ||
"linebreak-style": "off", | ||
"lines-around-comment": [ | ||
"error", | ||
{ | ||
"beforeBlockComment": true, | ||
"beforeLineComment": true, | ||
"afterBlockComment": false, | ||
"allowBlockStart": true, | ||
"allowObjectStart": true, | ||
"allowArrayStart": true, | ||
"allowClassStart": true | ||
} | ||
], | ||
"lines-between-class-members": ["error", "always"], | ||
"max-lines": ["error", 500], | ||
"multiline-comment-style": ["error", "starred-block"], | ||
"new-cap": [ | ||
"error", | ||
{ | ||
"newIsCap": true, | ||
"properties": false | ||
} | ||
], | ||
"newline-per-chained-call": "off", | ||
"no-array-constructor": "error", | ||
"no-bitwise": "error", | ||
"no-inline-comments": "error", | ||
"no-lonely-if": "error", | ||
"no-mixed-operators": "error", | ||
"no-mixed-spaces-and-tabs": "error", | ||
"no-multi-assign": "error", | ||
"no-multiple-empty-lines": [ | ||
"error", | ||
{ | ||
"max": 1 | ||
} | ||
], | ||
"no-nested-ternary": "error", | ||
"no-new-object": "error", | ||
"no-plusplus": "off", | ||
"no-restricted-syntax": ["error", "SwitchStatement"], | ||
"no-tabs": "off", | ||
"no-ternary": "error", | ||
"no-trailing-spaces": [ | ||
"error", | ||
{ | ||
"skipBlankLines": true, | ||
"ignoreComments": true | ||
} | ||
], | ||
"no-underscore-dangle": "off", | ||
"no-whitespace-before-property": "error", | ||
"object-curly-spacing": ["error", "always"], | ||
"operator-linebreak": "off", | ||
"quote-props": ["error", "as-needed"], | ||
"quotes": ["error", "single"], | ||
"semi": ["error", "never"], | ||
"space-infix-ops": "error", | ||
"wrap-regex": "error", | ||
"arrow-body-style": ["error", "always"], | ||
"arrow-parens": ["error", "always"], | ||
"arrow-spacing": [ | ||
"error", | ||
{ | ||
"before": true, | ||
"after": true | ||
} | ||
], | ||
"no-confusing-arrow": "error", | ||
"no-const-assign": "error", | ||
"no-duplicate-imports": "error", | ||
"no-var": "error", | ||
"prefer-const": "warn", | ||
"prefer-rest-params": "error", | ||
"prefer-spread": "warn", | ||
"prefer-template": "warn", | ||
"rest-spread-spacing": ["error", "never"], | ||
"symbol-description": "error", | ||
"spaced-comment": ["error", "always"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,6 @@ dist | |
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# local test | ||
local-test/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"printWidth": 100, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": false, | ||
"singleQuote": true, | ||
"quoteProps": "as-needed", | ||
"trailingComma": "es5", | ||
"bracketSpacing": true, | ||
"arrowParens": "always", | ||
"endOfLine": "auto", | ||
"embeddedLanguageFormatting": "auto" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# egg-kit | ||
# egg-kit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict' | ||
|
||
const launch = require('./lib/launch.js') | ||
|
||
module.exports = (agent) => { | ||
if (agent.config.kit.agent) { | ||
launch(agent) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict' | ||
|
||
const launch = require('./lib/launch.js') | ||
|
||
module.exports = (app) => { | ||
if (app.config.kit.app) { | ||
launch(app) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict' | ||
|
||
exports.kit = { | ||
app: true, | ||
ageng: false, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict' | ||
|
||
const stringKit = require('../lib/string.js') | ||
|
||
module.exports = (app) => { | ||
app.kit = Object.assign({}, stringKit) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict' | ||
|
||
const crypto = require('crypto') | ||
|
||
/** | ||
* 生成指定长度的随机英文字符串 | ||
* @param {number} [length] 生成的英文随机字符串长度 | ||
* @returns {string} | ||
* @since 0.0.2 | ||
*/ | ||
function randomString(length) { | ||
// length 为 0 或未定义,直接返回空字符串 | ||
if (!length) { | ||
return '' | ||
} | ||
|
||
const buf = crypto.randomBytes(length * 2) | ||
|
||
const str = buf.toString('base64').replace(/\+/gu, '').replace(/\//gu, '').replace(/[=]/gu, '') | ||
|
||
return str.slice(0, length) | ||
} | ||
|
||
module.exports = { | ||
randomString, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "egg-kit", | ||
"version": "0.0.2", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/inlym/egg-kit.git" | ||
}, | ||
"keywords": [ | ||
"inlym", | ||
"egg", | ||
"egg-plugin", | ||
"eggPlugin", | ||
"kit" | ||
], | ||
"author": "inlym", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/inlym/egg-kit/issues" | ||
}, | ||
"homepage": "https://github.com/inlym/egg-kit#readme" | ||
} |