Skip to content

Commit

Permalink
feat(contentful/dynamo): optimize eslint & jest
Browse files Browse the repository at this point in the history
jest 25 (npm i jest@next) is much faster than 24.x
don't specify parserOptions.project (typescript-eslint/typescript-eslint#389)
eslint_d eliminates eslint startup time
  • Loading branch information
dpinol committed Oct 18, 2019
1 parent 0830512 commit e402da2
Show file tree
Hide file tree
Showing 8 changed files with 4,309 additions and 2,800 deletions.
4 changes: 0 additions & 4 deletions packages/botonic-plugin-contentful/.eslintrc.js
Expand Up @@ -16,7 +16,6 @@ module.exports = {
"@typescript-eslint"
],
parserOptions: {
project: "./tsconfig.json",
ecmaVersion: 2017, // async is from ecma2017. Supported in node >=7.10
sourceType: "module", // Allows for the use of imports
ecmaFeatures: {
Expand All @@ -43,8 +42,6 @@ module.exports = {
// special for TYPESCRIPT
"@typescript-eslint/explicit-function-return-type": "off", // annoying for tests
"@typescript-eslint/explicit-member-accessibility": "off", //we think defaulting to public is a good default
"@typescript-eslint/no-floating-promises": "error", // see https://github.com/xjamundx/eslint-plugin-promise/issues/151
"@typescript-eslint/no-misused-promises": "error",
"@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }], // to encapsulate types in namespace with same name as Class
"@typescript-eslint/no-non-null-assertion" : "warn", // specially useful in tests, and "when you know what you're doing"
"@typescript-eslint/no-object-literal-type-assertion" : [ "error", {allowAsParameter: false}], //useful to pass options to plugins
Expand All @@ -53,7 +50,6 @@ module.exports = {
// otoh, variables (typically constants) should be declared at the top
"@typescript-eslint/no-use-before-define": ["error", { "variables": true, "functions": false, "classes": false }],
"@typescript-eslint/no-useless-constructor": "warn",
"@typescript-eslint/require-await": "error",
"no-empty-pattern" : "off",
"no-null/no-null": "warn", // fields declared with ? are undefined, not null (be aware that React uses null)
"unicorn/prevent-abbreviations" : "off", // the plugin removes removes type annotations from typescript code :-(
Expand Down
8 changes: 8 additions & 0 deletions packages/botonic-plugin-contentful/.eslintrc_slow.js
@@ -0,0 +1,8 @@
const base = require('./.eslintrc');
base.parserOptions.project = "./tsconfig.json";

base.rules["@typescript-eslint/no-floating-promises"] = "error"; // see https://github.com/xjamundx/eslint-plugin-promise/issues/151
base.rules["@typescript-eslint/no-misused-promises"] = "error";
base.rules["@typescript-eslint/require-await"] = "error";

module.exports = base;

0 comments on commit e402da2

Please sign in to comment.