diff --git a/.eslintrc.json b/.eslintrc.json index a59acbc5b6..3dec5a3fea 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -419,17 +419,23 @@ }, "plugins": ["@typescript-eslint"], "rules": { + // Disable base rule to avoid conflict "empty-returns/main": 0, "indent": 0, + "func-call-spacing": 0, + "no-magic-numbers": 0, + "semi": 0, "@typescript-eslint/adjacent-overload-signatures": 2, "@typescript-eslint/array-type": 2, + "@typescript-eslint/await-thenable": 2, "@typescript-eslint/ban-types": 2, "@typescript-eslint/ban-ts-ignore": 0, "@typescript-eslint/camelcase": 0, "@typescript-eslint/class-name-casing": 2, - "@typescript-eslint/explicit-function-return-type": 2, + "@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }], "@typescript-eslint/explicit-member-accessibility": 0, + "@typescript-eslint/func-call-spacing": 2, "@typescript-eslint/generic-type-naming": 0, "@typescript-eslint/indent": 2, "@typescript-eslint/interface-name-prefix": 0, @@ -443,6 +449,7 @@ "@typescript-eslint/no-extraneous-class": 2, "@typescript-eslint/no-for-in-array": 0, "@typescript-eslint/no-inferrable-types": 2, + "@typescript-eslint/no-magic-numbers": 2, "@typescript-eslint/no-misused-new": 2, "@typescript-eslint/no-namespace": 2, "@typescript-eslint/no-non-null-assertion": 0, @@ -458,12 +465,18 @@ "@typescript-eslint/no-use-before-define": 2, "@typescript-eslint/no-useless-constructor": 2, "@typescript-eslint/no-var-requires": 0, + "@typescript-eslint/prefer-for-of": 0, "@typescript-eslint/prefer-function-type": 0, + "@typescript-eslint/prefer-includes": 2, "@typescript-eslint/prefer-interface": 0, "@typescript-eslint/prefer-namespace-keyword": 2, + "@typescript-eslint/prefer-regexp-exec": 2, + "@typescript-eslint/prefer-string-starts-ends-with": 2, "@typescript-eslint/promise-function-async": 2, "@typescript-eslint/restrict-plus-operands": 0, + "@typescript-eslint/semi": 2, "@typescript-eslint/type-annotation-spacing": 2, + "@typescript-eslint/unbound-method": 0, "@typescript-eslint/unified-signatures": 2 } } diff --git a/package.json b/package.json index d6f3b9c46c..cbaf718f42 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "zxcvbn": "4.4.2" }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "1.5.0", + "@typescript-eslint/eslint-plugin": "1.9.0", "@typescript-eslint/parser": "1.5.0", "casperjs": "casperjs/casperjs", "cssstyle": "0.2.29", diff --git a/static/js/dict.ts b/static/js/dict.ts index b628481787..0fd1e755df 100644 --- a/static/js/dict.ts +++ b/static/js/dict.ts @@ -4,10 +4,10 @@ import * as _ from 'underscore'; * Implementation detail of the Dict class. `key` is `k` converted to a string, * in lowercase if the `fold_case` option is enabled. */ -type KeyValue = { k: K; v: V } +type KeyValue = { k: K; v: V }; type Items = { [key: string]: KeyValue; -} +}; /** * This class primarily exists to support the fold_case option, because so many diff --git a/yarn.lock b/yarn.lock index 335499fbf4..901516e1fb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -160,16 +160,26 @@ "@types/uglify-js" "*" source-map "^0.6.0" -"@typescript-eslint/eslint-plugin@1.5.0": - version "1.5.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.5.0.tgz#85c509bcfc2eb35f37958fa677379c80b7a8f66f" - integrity sha512-TZ5HRDFz6CswqBUviPX8EfS+iOoGbclYroZKT3GWGYiGScX0qo6QjHc5uuM7JN920voP2zgCkHgF5SDEVlCtjQ== +"@typescript-eslint/eslint-plugin@1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-1.9.0.tgz#29d73006811bf2563b88891ceeff1c5ea9c8d9c6" + integrity sha512-FOgfBorxjlBGpDIw+0LaZIXRX6GEEUfzj8LXwaQIUCp+gDOvkI+1WgugJ7SmWiISqK9Vj5r8S7NDKO/LB+6X9A== dependencies: - "@typescript-eslint/parser" "1.5.0" - "@typescript-eslint/typescript-estree" "1.5.0" + "@typescript-eslint/experimental-utils" "1.9.0" + "@typescript-eslint/parser" "1.9.0" + eslint-utils "^1.3.1" + functional-red-black-tree "^1.0.1" + regexpp "^2.0.1" requireindex "^1.2.0" tsutils "^3.7.0" +"@typescript-eslint/experimental-utils@1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-1.9.0.tgz#a92777d0c92d7bc8627abd7cdb06cdbcaf2b39e8" + integrity sha512-1s2dY9XxBwtS9IlSnRIlzqILPyeMly5tz1bfAmQ84Ul687xBBve5YsH5A5EKeIcGurYYqY2w6RkHETXIwnwV0A== + dependencies: + "@typescript-eslint/typescript-estree" "1.9.0" + "@typescript-eslint/parser@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.5.0.tgz#a96114d195dff2a49534e4c4850fb676f905a072" @@ -179,6 +189,16 @@ eslint-scope "^4.0.0" eslint-visitor-keys "^1.0.0" +"@typescript-eslint/parser@1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-1.9.0.tgz#5796cbfcb9a3a5757aeb671c1ac88d7a94a95962" + integrity sha512-CWgC1XrQ34H/+LwAU7vY5xteZDkNqeAkeidEpJnJgkKu0yqQ3ZhQ7S+dI6MX4vmmM1TKRbOrKuXc6W0fIHhdbA== + dependencies: + "@typescript-eslint/experimental-utils" "1.9.0" + "@typescript-eslint/typescript-estree" "1.9.0" + eslint-scope "^4.0.0" + eslint-visitor-keys "^1.0.0" + "@typescript-eslint/typescript-estree@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.5.0.tgz#986b356ecdf5a0c3bc9889d221802149cf5dbd4e" @@ -187,6 +207,14 @@ lodash.unescape "4.0.1" semver "5.5.0" +"@typescript-eslint/typescript-estree@1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-1.9.0.tgz#5d6d49be936e96fb0f859673480f89b070a5dd9b" + integrity sha512-7Eg0TEQpCkTsEwsl1lIzd6i7L3pJLQFWesV08dS87bNz0NeSjbL78gNAP1xCKaCejkds4PhpLnZkaAjx9SU8OA== + dependencies: + lodash.unescape "4.0.1" + semver "5.5.0" + "@webassemblyjs/ast@1.4.3": version "1.4.3" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.4.3.tgz#3b3f6fced944d8660273347533e6d4d315b5934a"