mirror of
https://github.com/primer/css.git
synced 2024-12-21 13:11:49 +03:00
percautions in case path is wrong
This commit is contained in:
parent
f9934496f6
commit
091e2e75ae
15
index.js
15
index.js
@ -31,7 +31,20 @@ function buildUtilityClasses(options) {
|
|||||||
module.exports = stylelint.createPlugin(ruleName, function(enabled, options) {
|
module.exports = stylelint.createPlugin(ruleName, function(enabled, options) {
|
||||||
return function(root, result) {
|
return function(root, result) {
|
||||||
|
|
||||||
var utilityClasses = buildUtilityClasses(options)
|
var validOptions = stylelint.utils.validateOptions(result, ruleName, {
|
||||||
|
actual: enabled,
|
||||||
|
possible: [true, false]
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!validOptions) { return }
|
||||||
|
|
||||||
|
var utilityClasses = []
|
||||||
|
|
||||||
|
try {
|
||||||
|
utilityClasses = buildUtilityClasses(options)
|
||||||
|
} catch (e) {
|
||||||
|
// Editor plugin won't work, needs correct path
|
||||||
|
}
|
||||||
|
|
||||||
if (utilityClasses.length == 0) {
|
if (utilityClasses.length == 0) {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user