From e85f68838d51f2c17f489f690cc396955f05e33c Mon Sep 17 00:00:00 2001 From: qingzhou Date: Fri, 12 Jan 2018 14:07:44 -0800 Subject: [PATCH] Add infrastructure related files --- .editorconfig | 23 +++++ .eslintrc.json | 266 ++++++++++++++++++++++++++++++++++++++++++++++++ .gitattributes | 4 + .gitignore | 11 ++ .markdownlintrc | 9 ++ tsconfig.json | 23 +++++ 6 files changed, 336 insertions(+) create mode 100644 .editorconfig create mode 100644 .eslintrc.json create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .markdownlintrc create mode 100644 tsconfig.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..bce7b8d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,23 @@ +# For more information about the configurations used +# in this file, please see the EditorConfig documentation. +# +# http://editorconfig.org + +root = true + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +[*] + +charset = utf-8 +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +[{package.json}] + +indent_size = 2 +indent_style = space diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..7df9001 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,266 @@ +{ + "env": { + "node": true, + "es6": true + }, + "parserOptions": { + "ecmaVersion": 8, + "impliedStrict": true, + "sourceType": "module" + }, + "parser": "typescript-eslint-parser", + "plugins": [ + "markdown", + "typescript" + ], + "rules": { + "accessor-pairs": "off", + "arrow-body-style": ["error", "always"], + "array-bracket-spacing": ["error", "never"], + "array-callback-return": "error", + "arrow-parens": ["error", "always"], + "arrow-spacing": "error", + "block-spacing": "error", + "block-scoped-var": "error", + "brace-style": ["error", "1tbs"], + "callback-return": ["error", [ + "callback", + "cb", + "next"] + ], + "camelcase": ["error", { + "properties": "always" + }], + "comma-dangle": "error", + "comma-spacing": ["error", { + "before": false, + "after": true + }], + "comma-style": ["error", "last"], + "complexity": ["off", 5], + "computed-property-spacing": ["error", "never"], + "consistent-this": ["error", "that"], + "consistent-return": "error", + "curly": ["error", "all"], + "default-case": "error", + "dot-location": ["error", "property"], + "dot-notation": "error", + "eol-last": "error", + "eqeqeq": "error", + "for-direction": "error", + "func-call-spacing": "error", + "func-names": "off", + "func-style": ["error", "expression"], + "guard-for-in": "error", + "handle-callback-err": "error", + "id-length": "off", + "id-match": "off", + "indent": ["error", 4, { + "SwitchCase": 1, + "VariableDeclarator": 1 + }], + "init-declarations": "off", + "key-spacing": ["error", { + "beforeColon": false, + "afterColon": true + }], + "keyword-spacing": "error", + "linebreak-style": "off", + "lines-around-comment": "off", + "max-len": "off", + "max-nested-callbacks": ["error", 5], + "max-statements-per-line": "error", + "new-cap": "error", + "new-parens": "error", + "newline-per-chained-call": "error", + "no-alert": "error", + "no-array-constructor": "error", + "no-buffer-constructor": "error", + "no-caller": "error", + "no-case-declarations": "error", + "no-catch-shadow": "error", + "no-cond-assign": "error", + "no-confusing-arrow": "error", + "no-console": "off", + "no-const-assign": "error", + "no-constant-condition": "error", + "no-control-regex": "error", + "no-debugger": "error", + "no-delete-var": "error", + "no-div-regex": "error", + "no-dupe-args": "error", + "no-dupe-class-members": "error", + "no-dupe-keys": "error", + "no-duplicate-case": "error", + "no-else-return": "error", + "no-empty": "error", + "no-empty-character-class": "error", + "no-empty-pattern": "error", + "no-eq-null": "error", + "no-ex-assign": "error", + "no-extend-native": "error", + "no-extra-bind": "error", + "no-extra-boolean-cast": "error", + "no-extra-parens": "off", + "no-extra-semi": "error", + "no-eval": "error", + "no-fallthrough": "error", + "no-floating-decimal": "error", + "no-func-assign": "error", + "no-global-assign": "error", + "no-implicit-coercion": "off", + "no-implicit-globals": "error", + "no-implied-eval": "error", + "no-inner-declarations": ["error", "functions"], + "no-invalid-regexp": "error", + "no-invalid-this": "error", + "no-irregular-whitespace": "error", + "no-iterator": "error", + "no-labels": "error", + "no-label-var": "error", + "no-lone-blocks": "error", + "no-lonely-if": "error", + "no-loop-func": "error", + "no-mixed-operators": "off", + "no-mixed-requires": [1, true], + "no-mixed-spaces-and-tabs": ["error", "smart-tabs"], + "no-multiple-empty-lines": ["error", { + "max": 2, + "maxEOF": 0, + "maxBOF": 0 + }], + "no-multi-spaces": "error", + "no-multi-str": "error", + "no-nested-ternary": "error", + "no-new": "error", + "no-new-func": "error", + "no-new-object": "error", + "no-new-require": "error", + "no-new-wrappers": "error", + "no-obj-calls": "error", + "no-octal-escape": "error", + "no-octal": "error", + "no-param-reassign": ["error", { + "props": false + }], + "no-path-concat": "error", + "no-plusplus": "off", + "no-proto": "error", + "no-process-env": "error", + "no-process-exit": "error", + "no-prototype-builtins": "off", + "no-redeclare": "error", + "no-regex-spaces": "error", + "no-restricted-globals": "error", + "no-restricted-modules": "error", + "no-restricted-properties": "error", + "no-restricted-syntax": "off", + "no-return-assign": "error", + "no-script-url": "error", + "no-self-assign": "error", + "no-self-compare": "error", + "no-sequences": "error", + "no-shadow": "error", + "no-shadow-restricted-names": "error", + "no-sparse-arrays": "error", + "no-sync": "error", + "no-ternary": "off", + "no-throw-literal": "error", + "no-trailing-spaces": "error", + "no-undef-init": "error", + "no-undefined": "error", + "no-underscore-dangle": "off", + "no-unexpected-multiline": "error", + "no-unmodified-loop-condition": "error", + "no-unneeded-ternary": "error", + "no-unreachable": "error", + "no-unsafe-finally": "error", + "no-unsafe-negation": "error", + "no-unused-expressions": "error", + "no-unused-vars": ["error", { + "vars": "all", + "args": "after-used" + }], + "no-use-before-define": "error", + "no-useless-call": "error", + "no-useless-computed-key": "error", + "no-useless-concat": "error", + "no-useless-escape": "error", + "no-useless-rename": "error", + "no-var": "error", + "no-void": "off", + "no-warning-comments": ["warn", { + "terms": [ "fixme" ], + "location": "start" + }], + "no-with": "error", + "object-shorthand": "error", + "object-curly-newline": ["error", { + "multiline": true + }], + "object-curly-spacing": ["off", "always", { + "objectsInObjects": false, + "arraysInObjects": false + }], + "one-var": "off", + "operator-assignment": ["error", "always"], + "operator-linebreak": ["error", "after"], + "padding-line-between-statements": [ "error", + { "blankLine": "always", "prev": "*", "next": "return" }, + + { "blankLine": "always", "prev": ["const", "let", "var"], "next": "*"}, + { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]}, + + { "blankLine": "always", "prev": "directive", "next": "*" }, + { "blankLine": "any", "prev": "directive", "next": "directive" } + ], + "prefer-arrow-callback": "error", + "prefer-const": "error", + "prefer-numeric-literals": "error", + "prefer-rest-params": "error", + "prefer-spread": "error", + "prefer-template": "error", + "quotes": ["error", "single", { "allowTemplateLiterals": true }], + "quote-props": ["error", "as-needed"], + "radix": "off", + "require-await": "error", + "semi-spacing": ["error", { + "before": false, + "after": true + }], + "semi": ["error", "always"], + "semi-style": ["error", "last"], + "sort-keys": "error", + "sort-vars": "off", + "spaced-comment": ["error", "always"], + "space-in-parens": ["error", "never"], + "space-unary-ops": ["error", { + "words": true, + "nonwords": false + }], + "strict": ["error", "never"], // We are using alwaysStrict=true as a compiler option of TS + "switch-colon-spacing": ["error", { "after" : true, "before" : false }], + "template-curly-spacing": "error", + "use-isnan": "error", + "unicode-bom": "error", + "valid-jsdoc": "off", + "valid-typeof": "error", + "vars-on-top": "off", + "wrap-iife": ["error", "outside"], + "wrap-regex": "error", + "yoda": ["error", "never"], + + "typescript/class-name-casing": "error", + "typescript/explicit-member-accessibility": "error", + "typescript/interface-name-prefix": [ "error", "always" ], + "typescript/member-delimiter-style": "error", + "typescript/no-angle-bracket-type-assertion": "error", + "typescript/no-namespace": "error", + "typescript/no-parameter-properties": "error", + "typescript/no-triple-slash-reference": "error", + "typescript/no-unused-vars": "error", + "typescript/no-use-before-define": "error", + "typescript/prefer-namespace-keyword": "error", + "typescript/type-annotation-spacing": "error" + } +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..4e8d6ea --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# Automatically normalize line endings for all text-based files. +# https://git-scm.com/docs/gitattributes#_end_of_line_conversion + +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5a8ce6a --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +*.lock +*.log +*.pid +*.STALE +.DS_Store +/.nyc_output/ +/.vscode/ +/build/ +/coverage/ +rules/*/node_modules/ +rules/*/dist/ diff --git a/.markdownlintrc b/.markdownlintrc new file mode 100644 index 0000000..bdd7fb6 --- /dev/null +++ b/.markdownlintrc @@ -0,0 +1,9 @@ +{ + "MD013": { + "code_blocks": false + }, + "MD026": { + "punctuation": ".,;:!" + }, + "MD029": false +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..c4038c5 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "rootDir": ".", + "alwaysStrict": true, + "module": "commonjs", + "sourceMap": true, + "target": "esnext", + "declaration": true, + "lib": [ + "es2017", + "esnext", + "dom", + "dom.iterable" + ] + }, + "exclude": [ + "node_modules" + ], + "include": [ + "src/**/*.ts", + "tests/**/*.ts" + ] +}