From ea596fe4d58e87547115d706255eb76a66e86ddb Mon Sep 17 00:00:00 2001 From: Segun Adebayo Date: Fri, 8 Oct 2021 16:44:57 +0400 Subject: [PATCH] chore: update setup --- .commitlintrc | 5 ---- .lintstagedrc | 8 ------ .prettierrc | 11 ------- babel.config.js | 30 +++++--------------- cypress.json | 8 +++++- cypress/{.eslintrc.json => .eslintrc} | 0 cypress/support/{commands.js => commands.ts} | 0 cypress/support/{index.js => index.ts} | 0 cypress/tsconfig.json | 3 +- package.json | 26 ++++++++++++++++- tsconfig.eslint.json | 2 +- tsconfig.json | 11 +++++-- 12 files changed, 51 insertions(+), 53 deletions(-) delete mode 100644 .commitlintrc delete mode 100644 .lintstagedrc delete mode 100644 .prettierrc rename cypress/{.eslintrc.json => .eslintrc} (100%) rename cypress/support/{commands.js => commands.ts} (100%) rename cypress/support/{index.js => index.ts} (100%) diff --git a/.commitlintrc b/.commitlintrc deleted file mode 100644 index 0df1d2536d..0000000000 --- a/.commitlintrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": [ - "@commitlint/config-conventional" - ] -} diff --git a/.lintstagedrc b/.lintstagedrc deleted file mode 100644 index 67d9ddfe57..0000000000 --- a/.lintstagedrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "**/*.{ts,tsx,js,jsx}": [ - "prettier --write" - ], - "**/*.{md,yml,json,babelrc,eslintrc,prettierrc}": [ - "prettier --write" - ] -} diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index a8de4e8098..0000000000 --- a/.prettierrc +++ /dev/null @@ -1,11 +0,0 @@ -{ - "bracketSpacing": true, - "jsxBracketSameLine": false, - "jsxSingleQuote": false, - "printWidth": 120, - "proseWrap": "always", - "semi": false, - "singleQuote": false, - "tabWidth": 2, - "trailingComma": "all" -} diff --git a/babel.config.js b/babel.config.js index 29eefce6b3..845eac9a8e 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,32 +1,16 @@ -const BABEL_ENV = process.env.BABEL_ENV -const isCommonJS = BABEL_ENV !== undefined && BABEL_ENV === "cjs" -const isESM = BABEL_ENV !== undefined && BABEL_ENV === "esm" - -module.exports = function babelConfig(api) { - api.cache(true) - - const presets = [ +module.exports = { + presets: [ [ "@babel/env", { - loose: true, - modules: isCommonJS ? "commonjs" : false, + bugfixes: true, targets: { - node: "current", - esmodules: isESM ? true : undefined, + browsers: "Chrome >= 74, Safari >= 13.1, iOS >= 13.3, Firefox >= 78, Edge >= 79", + node: 12, }, }, ], "@babel/preset-typescript", - ] - - const plugins = [ - ["@babel/plugin-proposal-private-methods", { loose: false }], - "@babel/plugin-proposal-class-properties", - ] - - return { - presets, - plugins, - } + ], + plugins: [["@babel/plugin-proposal-private-methods", { loose: false }], "@babel/plugin-proposal-class-properties"], } diff --git a/cypress.json b/cypress.json index 0967ef424b..ba2c390206 100644 --- a/cypress.json +++ b/cypress.json @@ -1 +1,7 @@ -{} +{ + "viewportWidth": 1024, + "viewportHeight": 768, + "fixturesFolder": false, + "pluginsFile": false, + "videoUploadOnPasses": false +} diff --git a/cypress/.eslintrc.json b/cypress/.eslintrc similarity index 100% rename from cypress/.eslintrc.json rename to cypress/.eslintrc diff --git a/cypress/support/commands.js b/cypress/support/commands.ts similarity index 100% rename from cypress/support/commands.js rename to cypress/support/commands.ts diff --git a/cypress/support/index.js b/cypress/support/index.ts similarity index 100% rename from cypress/support/index.js rename to cypress/support/index.ts diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index 23f671dc80..90b6366193 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "target": "es5", "lib": ["es5", "dom"], - "types": ["cypress", "@testing-library/cypress", "cypress-real-events"] + "types": ["cypress", "@testing-library/cypress", "cypress-real-events"], + "isolatedModules": false }, "include": ["**/*.ts"] } diff --git a/package.json b/package.json index 9ad8564dfc..9538c00626 100644 --- a/package.json +++ b/package.json @@ -95,5 +95,29 @@ "packages/machines", "packages/core/*", "examples/*" - ] + ], + "lint-staged": { + "**/*.{ts,tsx,js,jsx}": [ + "prettier --write" + ], + "**/*.{md,yml,json,babelrc,eslintrc,prettierrc}": [ + "prettier --write" + ] + }, + "prettier": { + "bracketSpacing": true, + "jsxBracketSameLine": false, + "jsxSingleQuote": false, + "printWidth": 120, + "proseWrap": "always", + "semi": false, + "singleQuote": false, + "tabWidth": 2, + "trailingComma": "all" + }, + "commitlint": { + "extends": [ + "@commitlint/config-conventional" + ] + } } diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 13e0d03be4..6b1ff0631e 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -1,4 +1,4 @@ { "extends": "./tsconfig.json", - "include": ["**/*.config.js", "examples/**/*.ts", "examples/**/*.tsx"] + "include": ["**/*.config.js", "examples/**/*.ts", "examples/**/*.tsx", "cypress/**/*.ts"] } diff --git a/tsconfig.json b/tsconfig.json index 47f851abe2..37927cd576 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,17 +1,24 @@ { "compilerOptions": { + "allowJs": false, "allowSyntheticDefaultImports": true, "declaration": true, "declarationMap": true, "downlevelIteration": true, "esModuleInterop": true, "isolatedModules": true, + "forceConsistentCasingInFileNames": true, "jsx": "preserve", + "noEmit": true, "lib": ["dom", "esnext"], "module": "esnext", + "pretty": true, "moduleResolution": "node", - "noFallthroughCasesInSwitch": true, + "incremental": true, + "noFallthroughCasesInSwitch": false, "noImplicitAny": true, + "noImplicitThis": true, + "noImplicitReturns": false, "resolveJsonModule": true, "skipLibCheck": true, "sourceMap": true, @@ -20,7 +27,7 @@ "strictNullChecks": true, "strictPropertyInitialization": true, "suppressImplicitAnyIndexErrors": true, - "target": "es5" + "target": "es2018" }, "exclude": ["node_modules"], "include": ["packages", "scripts", "shared"],