Improve `lint-staged` config (#28704)

shrike
Renaud Chaput 2024-01-12 10:09:57 +01:00 committed by GitHub
parent 575ab085be
commit 923fc83190
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 7 deletions

View File

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

11
lint-staged.config.js Normal file
View File

@ -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;

View File

@ -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"
}
}

View File

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

View File

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

View File

@ -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/*"]