-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstylelint.config.js
48 lines (45 loc) · 1.37 KB
/
stylelint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const path = require("path")
const {execSync} = require("child_process")
function getFidusWriterPath() {
try {
const fwPath = execSync(
"python -c \"import fiduswriter; print(next(filter(lambda path: '/site-packages/' in path, fiduswriter.__path__), ''))\""
)
.toString()
.trim()
if (fwPath) {
return fwPath
}
throw new Error("Fidus Writer not found")
} catch (error) {
console.error(
"Failed to find Fidus Writer installation:",
error.message
)
process.exit(1)
}
}
const fidusWriterPath = getFidusWriterPath()
module.exports = {
extends: "stylelint-config-standard",
plugins: ["stylelint-value-no-unknown-custom-properties"],
rules: {
"color-hex-length": "long",
"max-nesting-depth": 2,
"csstools/value-no-unknown-custom-properties": [
true,
{
importFrom: [
path.join(fidusWriterPath, "base/static/css/colors.css")
]
}
],
"selector-class-pattern": [
"^(([a-z][a-z0-9]*)(-[a-z0-9]+)*)|(ProseMirror(-[a-z0-9]+)*)$",
{
message:
"Selector should use lowercase and separate words with hyphens (selector-class-pattern)"
}
]
}
}