@mrhenry/stylelint-mrhenry-prop-order 2.0.16 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
- const stylelint = require("stylelint");
2
- const order = require('./order.cjs');
1
+ import stylelint from 'stylelint';
2
+ import { order } from './order.mjs';
3
+
3
4
  const orderSet = new Set(order);
4
5
 
5
6
  const ruleName = "@mrhenry/stylelint-mrhenry-prop-order";
@@ -19,11 +20,16 @@ const ignoredAtRules = [
19
20
  'property'
20
21
  ];
21
22
 
22
- const ruleFunction = (primaryOption, secondaryOptionObject, context) => {
23
+ /** @type {import('stylelint').Rule<true|null>} */
24
+ const ruleFunction = (primaryOption, secondaryOption, context) => {
23
25
  return (postcssRoot, postcssResult) => {
24
- if (!primaryOption) {
25
- return;
26
- }
26
+ const validPrimary = stylelint.utils.validateOptions(postcssResult, ruleName, {
27
+ actual: primaryOption,
28
+ possible: [true]
29
+ });
30
+
31
+ /* c8 ignore next */
32
+ if (!validPrimary) return;
27
33
 
28
34
  postcssRoot.walk((container) => {
29
35
  if (container.type !== 'atrule' && container.type !== 'rule') {
@@ -134,4 +140,4 @@ ruleFunction.ruleName = ruleName;
134
140
  ruleFunction.messages = messages;
135
141
  ruleFunction.meta = meta;
136
142
 
137
- module.exports = stylelint.createPlugin(ruleName, ruleFunction);
143
+ export default stylelint.createPlugin(ruleName, ruleFunction);
@@ -1,4 +1,4 @@
1
- module.exports = [
1
+ export const order = [
2
2
  "accent-color",
3
3
  "align-content",
4
4
  "align-items",
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@mrhenry/stylelint-mrhenry-prop-order",
3
- "version": "2.0.16",
3
+ "version": "3.0.1",
4
4
  "description": "Mr. Henry's preferred order for CSS properties",
5
- "main": "stylelint-mrhenry-prop-order.cjs",
5
+ "type": "module",
6
+ "main": "index.mjs",
6
7
  "scripts": {
7
- "test": "npm run test:jest && npm run test:properties-list",
8
- "test:jest": "c8 --100 jest",
8
+ "test": "c8 --100 node --test && npm run test:properties-list",
9
9
  "test:properties-list": "node verify-properties-list.mjs"
10
10
  },
11
11
  "author": "Mr. Henry",
@@ -17,22 +17,19 @@
17
17
  "directory": "packages/prop-order"
18
18
  },
19
19
  "files": [
20
- "order.cjs",
21
- "stylelint-mrhenry-prop-order.cjs",
20
+ "order.mjs",
21
+ "index.mjs",
22
22
  "LICENSE",
23
23
  "README.md"
24
24
  ],
25
- "jest": {
26
- "preset": "jest-preset-stylelint"
27
- },
28
25
  "keywords": [
29
26
  "stylelint",
30
27
  "stylelint-plugin"
31
28
  ],
32
29
  "peerDependencies": {
33
- "stylelint": "^14.16.1 || ^15.0.0"
30
+ "stylelint": "^16.0.0"
34
31
  },
35
32
  "devDependencies": {
36
- "stylelint": "^15.11.0"
33
+ "stylelint": "^16.0.2"
37
34
  }
38
35
  }