From 923fc831903c11ae5cc885c9454403007c77d734 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Fri, 12 Jan 2024 10:09:57 +0100 Subject: [PATCH] Improve `lint-staged` config (#28704) --- .prettierignore | 2 ++ lint-staged.config.js | 11 +++++++++++ package.json | 6 ------ streaming/package.json | 2 +- streaming/tsconfig.json | 1 + tsconfig.json | 2 ++ 6 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 lint-staged.config.js diff --git a/.prettierignore b/.prettierignore index 305f0fd753..51850b2b28 100644 --- a/.prettierignore +++ b/.prettierignore @@ -73,3 +73,5 @@ app/javascript/styles/mastodon/reset.scss # Ignore the generated AUTHORS.md AUTHORS.md + +!lint-staged.config.js diff --git a/lint-staged.config.js b/lint-staged.config.js new file mode 100644 index 0000000000..06fe66d11e --- /dev/null +++ b/lint-staged.config.js @@ -0,0 +1,11 @@ +const config = { + '*': 'prettier --ignore-unknown --write', + 'Capfile|Gemfile|*.{rb,ruby,ru,rake}': + 'bundle exec rubocop --force-exclusion -a', + '*.{js,jsx,ts,tsx}': 'eslint --fix', + '*.{css,scss}': 'stylelint --fix', + '*.haml': 'bundle exec haml-lint -a', + '**/*.ts?(x)': () => 'tsc -p tsconfig.json --noEmit', +}; + +module.exports = config; diff --git a/package.json b/package.json index 16ed4decaa..e3ba91f45c 100644 --- a/package.json +++ b/package.json @@ -218,11 +218,5 @@ "react-router-dom": { "optional": true } - }, - "lint-staged": { - "*": "prettier --ignore-unknown --write", - "Capfile|Gemfile|*.{rb,ruby,ru,rake}": "bundle exec rubocop --force-exclusion -a", - "*.{js,jsx,ts,tsx}": "eslint --fix", - "*.{css,scss}": "stylelint --fix" } } diff --git a/streaming/package.json b/streaming/package.json index 2d70acb829..149055ca1b 100644 --- a/streaming/package.json +++ b/streaming/package.json @@ -13,7 +13,7 @@ }, "scripts": { "start": "node ./index.js", - "check:types": "tsc --noEmit" + "typecheck": "tsc --noEmit" }, "dependencies": { "cors": "^2.8.5", diff --git a/streaming/tsconfig.json b/streaming/tsconfig.json index 032274d856..f7bb711b9b 100644 --- a/streaming/tsconfig.json +++ b/streaming/tsconfig.json @@ -5,6 +5,7 @@ "module": "CommonJS", "moduleResolution": "node", "noUnusedParameters": false, + "tsBuildInfoFile": "../tmp/cache/streaming/tsconfig.tsbuildinfo", "paths": {} }, "include": ["./*.js", "./.eslintrc.js"] diff --git a/tsconfig.json b/tsconfig.json index ff9da29497..d1a77e5493 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,8 @@ "esModuleInterop": true, "skipLibCheck": true, "baseUrl": "./", + "incremental": true, + "tsBuildInfoFile": "tmp/cache/tsconfig.tsbuildinfo", "paths": { "mastodon": ["app/javascript/mastodon"], "mastodon/*": ["app/javascript/mastodon/*"]