From 2660d27878b288c3fd00f84e2660e6d0c341d1c0 Mon Sep 17 00:00:00 2001 From: Tom Jenkinson Date: Wed, 22 Nov 2023 18:43:51 +0000 Subject: [PATCH] Configure typescript, eslint and prettier caches (#5990) --- .gitignore | 1 + lint-staged.config.js | 2 +- package.json | 6 +++--- tsconfig-lib.json | 4 +++- tsconfig.json | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index f1d6f2cad63..8993e0dee37 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ coverage/ # eslint .eslintcache +/cache.tsbuildinfo # Visual Studio exclusions *.suo diff --git a/lint-staged.config.js b/lint-staged.config.js index e4136a0c6b8..38e33caa8c5 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -20,6 +20,6 @@ module.exports = async (allStagedFiles) => { eslintFiles.length && `eslint --cache --fix ${eslintFiles.map(addQuotes).join(' ')}`, prettierFiles.length && - `prettier --write ${prettierFiles.map(addQuotes).join(' ')}`, + `prettier --cache --write ${prettierFiles.map(addQuotes).join(' ')}`, ].filter(Boolean); }; diff --git a/package.json b/package.json index 6cbda2c2eb6..13d1b133221 100644 --- a/package.json +++ b/package.json @@ -40,12 +40,12 @@ "serve": "http-server -o /demo .", "docs": "doctoc ./docs/API.md && api-documenter markdown -i api-extractor -o api-extractor/api-documenter && rm api-extractor/api-documenter/index.md && npm run docs-md-to-html", "docs-md-to-html": "generate-md --layout github --input api-extractor/api-documenter --output api-docs", - "lint": "eslint src/ tests/ --ext .js --ext .ts", + "lint": "eslint --cache src/ tests/ --ext .js --ext .ts", "lint:fix": "npm run lint -- --fix", "lint:quiet": "npm run lint -- --quiet", "lint:staged": "lint-staged", - "prettier": "prettier --write .", - "prettier:verify": "prettier --check .", + "prettier": "prettier --cache --write .", + "prettier:verify": "prettier --cache --check .", "pretest": "npm run lint", "sanity-check": "npm run lint && npm run prettier:verify && npm run type-check && npm run build && es-check && npm run docs && npm run test:unit", "start": "npm run dev", diff --git a/tsconfig-lib.json b/tsconfig-lib.json index a6df3a51dca..528f21cd216 100644 --- a/tsconfig-lib.json +++ b/tsconfig-lib.json @@ -11,7 +11,9 @@ "lib": ["dom", "es2015"], "outDir": "./lib/", "allowSyntheticDefaultImports": true, - "emitDeclarationOnly": true + "emitDeclarationOnly": true, + "incremental": true, + "tsBuildInfoFile": "cache.tsbuildinfo" }, "include": ["src/**/*"], "exclude": ["node_modules", "dist/**/*", "demo/libs/**/*"] diff --git a/tsconfig.json b/tsconfig.json index 93f767a1a51..ede7ff28528 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,7 @@ /* needed for eslint to work for some reason ¯\_(ツ)_/¯ */ "tests/**/.eslintrc.js", "rollup.config.js", - "build-config.js" + "build-config.js", + "lint-staged.config.js" ] }