forked from ethereum/ethereum-org-website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.lintstagedrc.js
More file actions
22 lines (18 loc) · 727 Bytes
/
Copy path.lintstagedrc.js
File metadata and controls
22 lines (18 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const path = require("path")
const buildEslintCommand = (filenames) =>
`eslint --fix ${filenames
.map((f) => path.relative(process.cwd(), f))
.join(" ")}`
const formatCommand = "prettier --write"
const buildMarkdownLintCommand = (filenames) => {
const files = filenames
.map((f) => path.relative(process.cwd(), f))
.filter((f) => !f.startsWith("public/content/translations/"))
.join(" ")
if (!files) return 'echo "No English content files to lint"'
return `markdownlint-cli2 ${files} || (echo "\n Fix with: npx markdownlint-cli2 --fix ${files}\n"; exit 1)`
}
module.exports = {
"*.{js,jsx,ts,tsx}": [buildEslintCommand, formatCommand],
"public/content/**/*.md": buildMarkdownLintCommand,
}