@master/eslint-plugin-css 2.0.0-rc.19 → 2.0.0-rc.20

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.
@@ -12,6 +12,7 @@ function runValidRules(classNames, config) {
12
12
  css: currentCSS
13
13
  })[0];
14
14
  if (validRule) ruleOfClass[eachClassName] = {
15
+ vendorPrefixSelectors: validRule?.vendorPrefixSelectors,
15
16
  declarations: validRule?.declarations,
16
17
  stateToken: validRule?.stateToken
17
18
  };
@@ -2,4 +2,5 @@ import { Rule } from '@master/css';
2
2
  export default function runValidRules(classNames: string[], config: string | object): Record<string, {
3
3
  declarations: Rule['declarations'];
4
4
  stateToken: Rule['stateToken'];
5
+ vendorPrefixSelectors: Rule['vendorPrefixSelectors'];
5
6
  }>;
@@ -10,6 +10,7 @@ function runValidRules(classNames, config) {
10
10
  css: currentCSS
11
11
  })[0];
12
12
  if (validRule) ruleOfClass[eachClassName] = {
13
+ vendorPrefixSelectors: validRule?.vendorPrefixSelectors,
13
14
  declarations: validRule?.declarations,
14
15
  stateToken: validRule?.stateToken
15
16
  };
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var areDeclarationsEqual = require('../utils/are-declarations-equal.cjs');
4
+ var areVendorPrefixSelectorsEqual = require('../utils/are-vendor-prefix-selectors-equal.cjs');
4
5
  var defineVisitors = require('../utils/define-visitors.cjs');
5
6
  var resolveContext = require('../utils/resolve-context.cjs');
6
7
  var findLoc = require('../utils/find-loc.cjs');
@@ -66,7 +67,7 @@ var classCollision = createRule({
66
67
  for(let j = 0; j < classNames.length; j++){
67
68
  const compareClassName = classNames[j];
68
69
  const compareRule = ruleOfClass[compareClassName];
69
- if (i !== j && compareRule && areDeclarationsEqual(rule.declarations, compareRule.declarations) && rule.stateToken === compareRule.stateToken) {
70
+ if (i !== j && compareRule && areDeclarationsEqual(rule.declarations, compareRule.declarations) && areVendorPrefixSelectorsEqual(rule.vendorPrefixSelectors, compareRule.vendorPrefixSelectors) && rule.stateToken === compareRule.stateToken) {
70
71
  conflicts.push(compareClassName);
71
72
  }
72
73
  }
@@ -1,4 +1,5 @@
1
1
  import areDeclarationsEqual from '../utils/are-declarations-equal.mjs';
2
+ import areVendorPrefixSelectorsEqual from '../utils/are-vendor-prefix-selectors-equal.mjs';
2
3
  import defineVisitors from '../utils/define-visitors.mjs';
3
4
  import resolveContext from '../utils/resolve-context.mjs';
4
5
  import findLoc from '../utils/find-loc.mjs';
@@ -64,7 +65,7 @@ var classCollision = createRule({
64
65
  for(let j = 0; j < classNames.length; j++){
65
66
  const compareClassName = classNames[j];
66
67
  const compareRule = ruleOfClass[compareClassName];
67
- if (i !== j && compareRule && areDeclarationsEqual(rule.declarations, compareRule.declarations) && rule.stateToken === compareRule.stateToken) {
68
+ if (i !== j && compareRule && areDeclarationsEqual(rule.declarations, compareRule.declarations) && areVendorPrefixSelectorsEqual(rule.vendorPrefixSelectors, compareRule.vendorPrefixSelectors) && rule.stateToken === compareRule.stateToken) {
68
69
  conflicts.push(compareClassName);
69
70
  }
70
71
  }
@@ -114,7 +114,7 @@ var classOrder = createRule({
114
114
  visitNode(node, arg.key);
115
115
  break;
116
116
  case 'Literal':
117
- originalClassNamesValue = arg.value;
117
+ originalClassNamesValue = arg.raw.slice(1, arg.raw.length - 1);
118
118
  start = arg.range[0] + 1;
119
119
  end = arg.range[1] - 1;
120
120
  break;
@@ -112,7 +112,7 @@ var classOrder = createRule({
112
112
  visitNode(node, arg.key);
113
113
  break;
114
114
  case 'Literal':
115
- originalClassNamesValue = arg.value;
115
+ originalClassNamesValue = arg.raw.slice(1, arg.raw.length - 1);
116
116
  start = arg.range[0] + 1;
117
117
  end = arg.range[1] - 1;
118
118
  break;
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ function areVendorPrefixSelectorsEqual(aVendorPrefixSelectors, bVendorPrefixSelectors) {
4
+ const aKeys = Object.keys(aVendorPrefixSelectors);
5
+ if (aKeys.length !== Object.keys(bVendorPrefixSelectors).length) return false;
6
+ return aKeys.every((eachAKey)=>{
7
+ if (!Object.prototype.hasOwnProperty.call(bVendorPrefixSelectors, eachAKey)) return false;
8
+ const aValues = aVendorPrefixSelectors[eachAKey];
9
+ const bValues = bVendorPrefixSelectors[eachAKey];
10
+ return aValues.length === bValues.length && aValues.every((eachAValue)=>bValues.includes(eachAValue));
11
+ });
12
+ }
13
+
14
+ module.exports = areVendorPrefixSelectorsEqual;
@@ -0,0 +1 @@
1
+ export default function areVendorPrefixSelectorsEqual(aVendorPrefixSelectors: any, bVendorPrefixSelectors: any): boolean;
@@ -0,0 +1,12 @@
1
+ function areVendorPrefixSelectorsEqual(aVendorPrefixSelectors, bVendorPrefixSelectors) {
2
+ const aKeys = Object.keys(aVendorPrefixSelectors);
3
+ if (aKeys.length !== Object.keys(bVendorPrefixSelectors).length) return false;
4
+ return aKeys.every((eachAKey)=>{
5
+ if (!Object.prototype.hasOwnProperty.call(bVendorPrefixSelectors, eachAKey)) return false;
6
+ const aValues = aVendorPrefixSelectors[eachAKey];
7
+ const bValues = bVendorPrefixSelectors[eachAKey];
8
+ return aValues.length === bValues.length && aValues.every((eachAValue)=>bValues.includes(eachAValue));
9
+ });
10
+ }
11
+
12
+ export { areVendorPrefixSelectorsEqual as default };
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@master/eslint-plugin-css","type":"module","scripts":{"build":"techor build \"src/**/*.{js,ts}\"","dev":"pnpm build --watch","test":"jest","type-check":"tsc --noEmit","lint":"eslint src"},"keywords":["mastercss","eslint","eslintplugin"],"license":"MIT","description":"Master CSS ESLint Plugin","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/eslint-plugin"},"sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.mjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/css":"^2.0.0-rc.19","@master/css-validator":"^2.0.0-rc.19","@typescript-eslint/utils":"^7.0.2","explore-config":"^3.0.15","synckit":"^0.9.0","typescript-eslint":"^7.0.2"},"devDependencies":{"@angular-eslint/template-parser":"^16.3.1","@types/node":"^20.11.20","@typescript-eslint/rule-tester":"^7.0.2","eslint":"^8.57.0","eslint-plugin-markdown":"^3.0.1","eslint-plugin-mdx":"^2.3.4","svelte-eslint-parser":"^0.33.1","ts-node":"^10.9.2","vue-eslint-parser":"^9.4.2"},"version":"2.0.0-rc.19"}
1
+ {"name":"@master/eslint-plugin-css","type":"module","scripts":{"build":"techor build \"src/**/*.{js,ts}\"","dev":"pnpm build --watch","test":"jest","type-check":"tsc --noEmit","lint":"eslint src"},"keywords":["mastercss","eslint","eslintplugin"],"license":"MIT","description":"Master CSS ESLint Plugin","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/eslint-plugin"},"sideEffects":false,"main":"./dist/index.cjs","module":"./dist/index.mjs","jsnext:main":"./dist/index.mjs","esnext":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.cjs","types":"./dist/index.d.ts"}},"files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@master/css":"^2.0.0-rc.20","@master/css-validator":"^2.0.0-rc.20","@typescript-eslint/utils":"^7.0.2","explore-config":"^3.0.15","synckit":"^0.9.0","typescript-eslint":"^7.0.2"},"devDependencies":{"@angular-eslint/template-parser":"^16.3.1","@types/node":"^20.11.20","@typescript-eslint/rule-tester":"^7.0.2","eslint":"^8.57.0","eslint-plugin-markdown":"^3.0.1","eslint-plugin-mdx":"^2.3.4","svelte-eslint-parser":"^0.33.1","ts-node":"^10.9.2","vue-eslint-parser":"^9.4.2"},"version":"2.0.0-rc.20"}