-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
31 lines (26 loc) · 827 Bytes
/
index.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
var stylelint = require("stylelint");
var styleSearch = require('style-search');
var ruleName = "tmi/max-width-query"
module.exports = stylelint.createPlugin(ruleName, function (enabled) {
return function (root, result) {
var validOptions = stylelint.utils.validateOptions(result, ruleName, {
actual: enabled,
possible: [true, false]
})
if (!validOptions) { return }
root.walkAtRules(function (statement) {
styleSearch({
source: statement.toString(),
target: "@media (max-width",
}, function (match, count) {
stylelint.utils.report({
ruleName: ruleName,
result: result,
node: statement,
message: 'Expected min-width instead of max-width query.'
});
});
})
}
})
module.exports.ruleName = ruleName