diff --git a/config/rollup.js b/config/rollup.js index 35f9839..bebe0a7 100644 --- a/config/rollup.js +++ b/config/rollup.js @@ -3,6 +3,7 @@ import json from 'rollup-plugin-json'; import multiEntry from 'rollup-plugin-multi-entry'; import replace from 'rollup-plugin-replace'; import resolve from 'rollup-plugin-node-resolve'; +import tslint from 'rollup-plugin-tslint'; import typescript from 'rollup-plugin-typescript2'; const metadata = require('../package.json'); @@ -73,6 +74,7 @@ const bundle = { ], 'node_modules/lodash/lodash.js': [ 'cloneDeep', + 'defaultTo', 'intersection', 'isNil', 'isString', @@ -98,6 +100,10 @@ const bundle = { ], }, }), + tslint({ + configuration: './config/tslint.json', + throwOnError: true, + }), typescript({ cacheRoot: 'out/cache/rts2', rollupCommonJSResolveHack: true, diff --git a/config/tslint.cc.json b/config/tslint.cc.json new file mode 100755 index 0000000..5ce6ddb --- /dev/null +++ b/config/tslint.cc.json @@ -0,0 +1,154 @@ +{ + "extends": ["tslint:latest"], + "rules": { + "adjacent-overload-signatures": true, + "array-type": [ + true, + "generic" + ], + "arrow-parens": true, + "arrow-return-shorthand": true, + "await-promise": true, + "ban": [true, { + "message": "use lodash isString", + "name": ["util", "isString"] + }, { + "message": "use lodash isNil", + "name": ["util", "isNullOrUndefined"] + }], + "ban-comma-operator": true, + "ban-types": true, + "class-name": true, + "curly": true, + "cyclomatic-complexity": [ + true, + 12 + ], + "deprecation": true, + "eofline": true, + "increment-decrement": true, + "indent": [true, "spaces", 2], + "interface-name": [ + true, + "never-prefix" + ], + "max-classes-per-file": [ + true, + 1 + ], + "max-file-line-count": 250, + "max-line-length": [ + true, + 180 + ], + "member-access": true, + "member-ordering": [ + true, + { + "order": [ + "public-static-method", + "public-static-field", + "public-instance-field", + "protected-instance-field", + "public-constructor", + "public-instance-method", + "protected-instance-method" + ] + } + ], + "new-parens": true, + "no-angle-bracket-type-assertion": true, + "no-arg": true, + "no-bitwise": false, + "no-boolean-literal-compare": true, + "no-conditional-assignment": true, + "no-console": true, + "no-construct": true, + "no-dead-store": false, + "no-debugger": true, + "no-default-export": true, + "no-default-import": true, + "no-duplicate-super": true, + "no-duplicate-variable": true, + "no-empty-interface": true, + "no-floating-promises": true, + "no-for-in-array": true, + "no-implicit-dependencies": false, + "no-inferred-empty-object-type": true, + "no-inferrable-types": [ + true, + "ignore-params", + "ignore-properties" + ], + "no-internal-module": true, + "no-invalid-this": true, + "no-irregular-whitespace": true, + "no-magic-numbers": [ + true, + -1, 0, + 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 20, 30, 40, 50, 60, 70, 80, 90, + 100 + ], + "no-misused-new": true, + "no-namespace": true, + "no-non-null-assertion": true, + "no-null-keyword": true, + "no-parameter-properties": true, + "no-parameter-reassignment": true, + "no-return-await": true, + "no-shadowed-variable": true, + "no-sparse-arrays": true, + "no-string-literal": true, + "no-string-throw": true, + "no-submodule-imports": false, + "no-unbound-method": true, + "no-unused-expression": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "no-void-expression": true, + "prefer-conditional-expression": false, + "prefer-const": true, + "prefer-for-of": true, + "prefer-readonly": true, + "prefer-switch": true, + "quotemark": [ + true, + "single", + "jsx-double", + "avoid-escape" + ], + "radix": true, + "restrict-plus-operands": true, + "strict-boolean-expressions": true, + "strict-type-predicates": true, + "switch-default": true, + "trailing-comma": [ + true, + { + "multiline": "always", + "singleline": "never" + } + ], + "triple-equals": true, + "unnecessary-constructor": true, + "use-default-type-parameter": true, + "use-isnan": true, + "variable-name": [ + true, + "ban-keywords", + "check-format" + ] + }, + "jsRules": { + "curly": true, + "trailing-comma": [ + true, + { + "multiline": "never", + "singleline": "never" + } + ] + }, + "rulesDirectory": [] +} diff --git a/config/tslint.json b/config/tslint.json index f74368d..7626af0 100755 --- a/config/tslint.json +++ b/config/tslint.json @@ -6,7 +6,7 @@ "no-banned-terms": true, "no-delete-expression": true, "no-for-in": true, - "no-relative-imports": true, + "no-relative-imports": false, "no-small-switch": false } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 4472c3a..069e24d 100644 --- a/package.json +++ b/package.json @@ -58,11 +58,15 @@ "rollup-plugin-multi-entry": "2.1.0", "rollup-plugin-node-resolve": "5.2.0", "rollup-plugin-replace": "2.2.0", + "rollup-plugin-tslint": "^0.2.2", "rollup-plugin-typescript2": "0.24.1", "sinon": "7.4.2", "source-map-support": "0.5.13", "standard-version": "7.0.0", "tslint": "5.19.0", + "tslint-clean-code": "^0.2.9", + "tslint-microsoft-contrib": "^6.2.0", + "tslint-sonarts": "^1.9.0", "typescript": "3.6.3", "yargs": "14.0.0" }, diff --git a/yarn.lock b/yarn.lock index 42d2a08..f14815a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -805,6 +805,11 @@ diff@3.5.0, diff@^3.2.0, diff@^3.5.0: resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12" integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA== +diff@^4.0.1: + version "4.0.1" + resolved "https://artifacts.apextoaster.com/repository/group-npm/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" + integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== + dot-prop@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-3.0.0.tgz#1b708af094a49c9a0e7dbcad790aba539dac1177" @@ -1232,6 +1237,11 @@ hosted-git-info@^2.1.4: resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.7.1.tgz#97f236977bd6e125408930ff6de3eec6281ec047" integrity sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w== +immutable@^3.8.2: + version "3.8.2" + resolved "https://artifacts.apextoaster.com/repository/group-npm/immutable/-/immutable-3.8.2.tgz#c2439951455bb39913daf281376f1530e104adf3" + integrity sha1-wkOZUUVbs5kT2vKBN28VMOEErfM= + imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" @@ -1687,6 +1697,11 @@ mem@^4.0.0: mimic-fn "^2.0.0" p-is-promise "^2.0.0" +memoize-decorator@^1.0.2: + version "1.0.2" + resolved "https://artifacts.apextoaster.com/repository/group-npm/memoize-decorator/-/memoize-decorator-1.0.2.tgz#605a41715c4171db192a90098b00ab8d6e1102f5" + integrity sha1-YFpBcVxBcdsZKpAJiwCrjW4RAvU= + meow@^3.3.0: version "3.7.0" resolved "https://registry.yarnpkg.com/meow/-/meow-3.7.0.tgz#72cb668b425228290abbfa856892587308a801fb" @@ -2419,6 +2434,15 @@ rollup-plugin-replace@2.2.0: magic-string "^0.25.2" rollup-pluginutils "^2.6.0" +rollup-plugin-tslint@^0.2.2: + version "0.2.2" + resolved "https://artifacts.apextoaster.com/repository/group-npm/rollup-plugin-tslint/-/rollup-plugin-tslint-0.2.2.tgz#be440f020bffcb6622e3dd8d1b15a5234df833a5" + integrity sha512-1yF7bnDALlqgReMIsNDCNXOYqzCw9A8Ur5AS4RzlY7IsRBKB0yb+wx8ZCh0zBcXCeJP5tx36oqec4aX2Pzzttw== + dependencies: + rollup-pluginutils "^2.0.1" + tslint "^5.9.1" + typescript "^3.0.0" + rollup-plugin-typescript2@0.24.1: version "0.24.1" resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.24.1.tgz#6b6bd4c4dcfc7575af68b16f921a13ad32f68f47" @@ -2430,7 +2454,7 @@ rollup-plugin-typescript2@0.24.1: rollup-pluginutils "2.8.1" tslib "1.10.0" -rollup-pluginutils@2.8.1, rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1: +rollup-pluginutils@2.8.1, rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1: version "2.8.1" resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz#8fa6dd0697344938ef26c2c09d2488ce9e33ce97" integrity sha512-J5oAoysWar6GuZo0s+3bZ6sVZAC0pfqKz68De7ZgDi5z63jOVZn1uJL/+z1jeKHNbGII8kAyHF5q8LnxSX5lQg== @@ -2797,11 +2821,33 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= -tslib@1.10.0, tslib@^1.8.0, tslib@^1.8.1: +tslib@1.10.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== +tslint-clean-code@^0.2.9: + version "0.2.9" + resolved "https://artifacts.apextoaster.com/repository/group-npm/tslint-clean-code/-/tslint-clean-code-0.2.9.tgz#4accfdf92cc701b7dd783e736559e90905c68f6c" + integrity sha512-h9BqZIUsvqtns46IIto5fbouaERFd9Iu0NupTZ9s80frdm5eGhOWDp2VjfOx4LqgnvchMFX1xrj+dfWs4bVYog== + dependencies: + memoize-decorator "^1.0.2" + tsutils "2.7.1" + +tslint-microsoft-contrib@^6.2.0: + version "6.2.0" + resolved "https://artifacts.apextoaster.com/repository/group-npm/tslint-microsoft-contrib/-/tslint-microsoft-contrib-6.2.0.tgz#8aa0f40584d066d05e6a5e7988da5163b85f2ad4" + integrity sha512-6tfi/2tHqV/3CL77pULBcK+foty11Rr0idRDxKnteTaKm6gWF9qmaCNU17HVssOuwlYNyOmd9Jsmjd+1t3a3qw== + dependencies: + tsutils "^2.27.2 <2.29.0" + +tslint-sonarts@^1.9.0: + version "1.9.0" + resolved "https://artifacts.apextoaster.com/repository/group-npm/tslint-sonarts/-/tslint-sonarts-1.9.0.tgz#feb593e92db328c0328b430b838adbe65d504de9" + integrity sha512-CJWt+IiYI8qggb2O/JPkS6CkC5DY1IcqRsm9EHJ+AxoWK70lvtP7jguochyNDMP2vIz/giGdWCfEM39x/I/Vnw== + dependencies: + immutable "^3.8.2" + tslint@5.19.0: version "5.19.0" resolved "https://registry.yarnpkg.com/tslint/-/tslint-5.19.0.tgz#a2cbd4a7699386da823f6b499b8394d6c47bb968" @@ -2821,6 +2867,39 @@ tslint@5.19.0: tslib "^1.8.0" tsutils "^2.29.0" +tslint@^5.9.1: + version "5.20.0" + resolved "https://artifacts.apextoaster.com/repository/group-npm/tslint/-/tslint-5.20.0.tgz#fac93bfa79568a5a24e7be9cdde5e02b02d00ec1" + integrity sha512-2vqIvkMHbnx8acMogAERQ/IuINOq6DFqgF8/VDvhEkBqQh/x6SP0Y+OHnKth9/ZcHQSroOZwUQSN18v8KKF0/g== + dependencies: + "@babel/code-frame" "^7.0.0" + builtin-modules "^1.1.1" + chalk "^2.3.0" + commander "^2.12.1" + diff "^4.0.1" + glob "^7.1.1" + js-yaml "^3.13.1" + minimatch "^3.0.4" + mkdirp "^0.5.1" + resolve "^1.3.2" + semver "^5.3.0" + tslib "^1.8.0" + tsutils "^2.29.0" + +tsutils@2.7.1: + version "2.7.1" + resolved "https://artifacts.apextoaster.com/repository/group-npm/tsutils/-/tsutils-2.7.1.tgz#411a0e9466525a2b2869260a55620d7292155e24" + integrity sha1-QRoOlGZSWisoaSYKVWINcpIVXiQ= + dependencies: + tslib "^1.7.1" + +"tsutils@^2.27.2 <2.29.0": + version "2.28.0" + resolved "https://artifacts.apextoaster.com/repository/group-npm/tsutils/-/tsutils-2.28.0.tgz#6bd71e160828f9d019b6f4e844742228f85169a1" + integrity sha512-bh5nAtW0tuhvOJnx1GLRn5ScraRLICGyJV5wJhtRWOLsxW70Kk5tZtpK3O/hW6LDnqKS9mlUMPZj9fEMJ0gxqA== + dependencies: + tslib "^1.8.1" + tsutils@^2.29.0: version "2.29.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.29.0.tgz#32b488501467acbedd4b85498673a0812aca0b99" @@ -2838,7 +2917,7 @@ typedarray@^0.0.6: resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@3.6.3: +typescript@3.6.3, typescript@^3.0.0: version "3.6.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.3.tgz#fea942fabb20f7e1ca7164ff626f1a9f3f70b4da" integrity sha512-N7bceJL1CtRQ2RiG0AQME13ksR7DiuQh/QehubYcghzv20tnh+MQnQIuJddTmsbqYj+dztchykemz0zFzlvdQw==