8000 chore: fix lint-staged on Windows by jstarpl · Pull Request #242 · nrkno/sofie-core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: fix lint-staged on Windows #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions meteor/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
package*.json
CHANGELOG*.md
*.snap
*.xml
18 changes: 18 additions & 0 deletions meteor/lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const jsCssJsonMdScssCommands = ['prettier --write', 'git add']
const tsTsxCommands = ['npm run lintfix --', 'git add']

function chunkWrapAndRun(commands, fileNames) {
const fileCount = fileNames.length
let result = []
for (var i = 0; i < fileCount; i = i + 10) {
const chunk = fileNames.slice(i, i + 10)
const wrappedAndJoined = chunk.map((fileName) => `"${fileName}"`).join(' ')
result = result.concat(result.map((command) => `${command} ${wrappedAndJoined}`))
}
return result
}

module.exports = {
'*.{js,css,json,md,scss}': (fileNames) => chunkWrapAndRun(jsCssJsonMdScssCommands, fileNames),
'*.{ts,tsx}': (fileNames) => chunkWrapAndRun(tsTsxCommands, fileNames),
}
14 changes: 2 additions & 12 deletions meteor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"license-validate": "node-license-validator -p -d --allow-licenses MIT BSD BSD-3-Clause ISC Apache Public-Domain 'Public Domain' Unlicense WTFPL CC-BY-4.0 --allow-packages cycle @fortawesome/fontawesome-common-types",
"lint": "tslint --project tsconfig.test.json --config tslint.json",
"lintfix": "npm run lint --fix",
"quickformat": "(prettier \"__mocks__/**\" --write || true) && (prettier \"lib/**\" --write || true) && (prettier \"server/**\" --write || true) && (prettier \"client/**\" --write || true) && (prettier \"*.json\" --write || true) && (prettier \"*.js\" --write || true) && (prettier \"*.md\" --write || true)",
"quickformat": "prettier \"__mocks__/**\" --write ; prettier \"lib/**\" --write ; prettier \"server/**\" --write ; prettier \"client/**\" --write ; prettier \"*.json\" --write ; prettier \"*.js\" --write ; prettier \"*.md\" --write",
"i18n-extract-pot": "i18next-extract-gettext --files=\"{./client/ui/**/*.+(ts|tsx),./lib/mediaObjects.ts}\" --output=i18n/template.pot",
"i18n-compile-json": "npm run i18n-compile-json-nb & npm run i18n-compile-json-nn & npm run i18n-compile-json-sv",
"i18n-compile-json-nb": "i18next-conv -l nb -s i18n/nb.po -t public/locales/nb/translations.json --skipUntranslated",
Expand Down Expand Up @@ -149,15 +149,5 @@
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,css,json,md,scss}": [
"prettier --write",
"git add"
],
"*.{ts,tsx}": [
"npm run lintfix --",
"git add"
]
}
}
}
0