Browse Source

Update TSLint and convert failures to warning. (#3413)

* Update TSLint and convert failures to warning.

* Do not typecheck Javascript. Add async typing in dev.

* Bypass warnings as errors.

* Update TSLint rules.
Robert Stires 1 year ago
parent
commit
c737636013
6 changed files with 49 additions and 22 deletions
  1. 1 1
      config/webpack.config.dev.js
  2. 2 1
      package.json
  3. 1 1
      scripts/build.js
  4. 2 2
      tsconfig.json
  5. 36 14
      tslint.json
  6. 7 3
      yarn.lock

+ 1 - 1
config/webpack.config.dev.js

@@ -255,7 +255,7 @@ module.exports = {
     new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
     // Perform type checking and linting in a separate process to speed up compilation
     new ForkTsCheckerWebpackPlugin({
-      async: false,
+      async: true,
       watch: paths.appSrc,
       tsconfig: paths.appTsConfig,
       tslint: paths.appTsLint,

+ 2 - 1
package.json

@@ -76,7 +76,7 @@
     "ts-loader": "^3.5.0",
     "tsconfig-paths-webpack-plugin": "^2.0.0",
     "tslint": "^5.7.0",
-    "tslint-react": "^3.2.0",
+    "tslint-react": "^3.6.0",
     "typeface-lato": "^0.0.54",
     "typeface-ubuntu-mono": "^0.0.54",
     "url-loader": "0.6.2",
@@ -141,6 +141,7 @@
     "selenium-standalone": "^6.13.0",
     "svgr": "^1.9.0",
     "tslint-config-airbnb": "^5.6.0",
+    "tslint-config-prettier": "^1.13.0",
     "typescript": "^2.7.2",
     "wdio-dot-reporter": "0.0.9",
     "wdio-jasmine-framework": "0.3.4",

+ 1 - 1
scripts/build.js

@@ -130,7 +130,7 @@ function build(previousFileSizes) {
               'Most CI servers set it automatically.\n'
           )
         );
-        return reject(new Error(messages.warnings.join('\n\n')));
+        // return reject(new Error(messages.warnings.join('\n\n')));
       }
       return resolve({
         stats,

+ 2 - 2
tsconfig.json

@@ -5,7 +5,7 @@
     "target": "es5",
     "lib": ["es2017", "dom"],
     "sourceMap": true,
-    "allowJs": true,
+    "allowJs": false,
     "jsx": "react",
     "moduleResolution": "node",
     "forceConsistentCasingInFileNames": true,
@@ -33,4 +33,4 @@
     "jest",
     "src/setupTests.ts"
   ]
-}
+}

+ 36 - 14
tslint.json

@@ -1,16 +1,38 @@
 {
-    "extends": ["tslint-config-airbnb"],
-    "rules": {
-        "no-console": {
-            "severity": "warning"
-        },
-        "align": {
-          "severity": "warning"
-        },
-        "no-trailing-whitespace": true,
-        "variable-name": false,
-        "import-name": false,
-        "object-shorthand-properties-first": false,
-        "strict-boolean-expressions": false
-    }
+  "extends": [
+    "tslint:recommended",
+    "tslint-react",
+    "tslint-config-prettier"
+  ],
+  "rules": {
+    "align": { "severity": "warning" },
+    "array-type": false,
+    "ban-types": false,
+    "callable-types": { "severity": "warning" },
+    "class-name": { "severity": "warning" },
+    "curly": { "severity": "warning" },
+    "interface-name": { "severity": "warning" },
+    "interface-over-type-literal": { "severity": "warning" },
+    "jsdoc-format": { "severity": "warning" },
+    "jsx-boolean-value": { "severity": "warning" },
+    "jsx-key": { "severity": "warning" },
+    "jsx-no-lambda": { "severity": "warning" },
+    "jsx-self-close": { "severity": "warning" },
+    "max-classes-per-file": { "severity": "warning" },
+    "member-access": { "severity":"warning" },
+    "member-ordering": false,
+    "no-angle-bracket-type-assertion": { "severity": "warning" },
+    "no-console": { "severity": "warning" },
+    "no-empty-interface": { "severity": "warning" },
+    "no-empty": { "severity": "warning" },
+    "no-namespace": { "severity": "warning" },
+    "no-shadowed-variable": { "severity": "warning"},
+    "no-string-literal": { "severity": "warning" },
+    "no-unused-expression": { "severity": "warning" },
+    "object-literal-sort-keys": { "severity": "warning" },
+    "only-arrow-functions": { "severity": "warning" },
+    "ordered-imports": { "severity": "warning" },
+    "prefer-for-of": {"severity": "warning"},
+    "variable-name": { "severity": "warning" }
+  }
 }

+ 7 - 3
yarn.lock

@@ -10200,6 +10200,10 @@ tslint-config-airbnb@^5.6.0:
     tslint-eslint-rules "^4.1.1"
     tslint-microsoft-contrib "~5.0.1"
 
+tslint-config-prettier@^1.13.0:
+  version "1.13.0"
+  resolved "https://registry.yarnpkg.com/tslint-config-prettier/-/tslint-config-prettier-1.13.0.tgz#189e821931ad89e0364e4e292d5c44a14e90ecd6"
+
 tslint-consistent-codestyle@^1.10.0:
   version "1.11.1"
   resolved "https://registry.yarnpkg.com/tslint-consistent-codestyle/-/tslint-consistent-codestyle-1.11.1.tgz#fa39ff5f5f8a25c537bd1e1f50de6190a2f4d70d"
@@ -10221,9 +10225,9 @@ tslint-microsoft-contrib@~5.0.1:
   dependencies:
     tsutils "^2.12.1"
 
-tslint-react@^3.2.0:
-  version "3.5.1"
-  resolved "https://registry.yarnpkg.com/tslint-react/-/tslint-react-3.5.1.tgz#a5ca48034bf583fb63b42763bb89fa23062d5390"
+tslint-react@^3.6.0:
+  version "3.6.0"
+  resolved "https://registry.yarnpkg.com/tslint-react/-/tslint-react-3.6.0.tgz#7f462c95c4a0afaae82507f06517ff02942196a1"
   dependencies:
     tsutils "^2.13.1"