Jelajahi Sumber

Improve `lint-staged` config (#28704)

Renaud Chaput 4 bulan lalu
induk
melakukan
923fc83190
6 mengubah file dengan 17 tambahan dan 7 penghapusan
  1. 2 0
      .prettierignore
  2. 11 0
      lint-staged.config.js
  3. 0 6
      package.json
  4. 1 1
      streaming/package.json
  5. 1 0
      streaming/tsconfig.json
  6. 2 0
      tsconfig.json

+ 2 - 0
.prettierignore

@@ -73,3 +73,5 @@ app/javascript/styles/mastodon/reset.scss
 
 # Ignore the generated AUTHORS.md
 AUTHORS.md
+
+!lint-staged.config.js

+ 11 - 0
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;

+ 0 - 6
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"
   }
 }

+ 1 - 1
streaming/package.json

@@ -13,7 +13,7 @@
   },
   "scripts": {
     "start": "node ./index.js",
-    "check:types": "tsc --noEmit"
+    "typecheck": "tsc --noEmit"
   },
   "dependencies": {
     "cors": "^2.8.5",

+ 1 - 0
streaming/tsconfig.json

@@ -5,6 +5,7 @@
     "module": "CommonJS",
     "moduleResolution": "node",
     "noUnusedParameters": false,
+    "tsBuildInfoFile": "../tmp/cache/streaming/tsconfig.tsbuildinfo",
     "paths": {}
   },
   "include": ["./*.js", "./.eslintrc.js"]

+ 2 - 0
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/*"]