@brickflow/lint 0.0.32 → 0.0.34

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/shared.js +16 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brickflow/lint",
3
- "version": "0.0.32",
3
+ "version": "0.0.34",
4
4
  "type": "module",
5
5
  "description": "Shared ESLint configs for brickflow workspaces.",
6
6
  "files": [
package/shared.js CHANGED
@@ -139,6 +139,10 @@ const baseRules = {
139
139
  message: 'defineSlots is forbidden. Use props or alternative pattern.',
140
140
  selector: "CallExpression[callee.name='defineSlots']",
141
141
  },
142
+ {
143
+ message: 'Assign useScreen() only to a variable named screen.',
144
+ selector: "VariableDeclarator[init.type='CallExpression'][init.callee.name='useScreen'][id.name!='screen']",
145
+ },
142
146
  ],
143
147
  'no-return-assign': 'error',
144
148
  'no-script-url': 'error',
@@ -189,6 +193,16 @@ const tailwindcssRules = {
189
193
  'tailwindcss/no-custom-classname': [warn, { whitelist: ['global.*'] }],
190
194
  }
191
195
 
196
+ const screenClassRequiresCondition = (screen) => ({
197
+ message: `Elements using screen.${screen}Class must also set v-if="screen.${screen}".`,
198
+ selector: `VStartTag:has(VAttribute[directive=true]:has(VDirectiveKey[name.name='bind'][argument.name='class']):has(VExpressionContainer MemberExpression[object.name='screen'][property.name='${screen}Class'])):not(:has(VAttribute[directive=true]:has(VDirectiveKey[name.name='if']):has(VExpressionContainer MemberExpression[object.name='screen'][property.name='${screen}'])))`,
199
+ })
200
+
201
+ const screenConditionRequiresClass = (screen) => ({
202
+ message: `Elements using v-if="screen.${screen}" must also set :class="screen.${screen}Class".`,
203
+ selector: `VStartTag:has(VAttribute[directive=true]:has(VDirectiveKey[name.name='if']):has(VExpressionContainer MemberExpression[object.name='screen'][property.name='${screen}'])):not(:has(VAttribute[directive=true]:has(VDirectiveKey[name.name='bind'][argument.name='class']):has(VExpressionContainer MemberExpression[object.name='screen'][property.name='${screen}Class'])))`,
204
+ })
205
+
192
206
  const vueRules = {
193
207
  'vue/attribute-hyphenation': [
194
208
  'error',
@@ -248,6 +262,8 @@ const vueRules = {
248
262
  message: 'Use "@" symbol for Event|Emit.',
249
263
  selector: 'VIdentifier[rawName=/^on/]',
250
264
  },
265
+ ...['dk', 'lp', 'tb', 'mb', 'ms'].map(screenClassRequiresCondition),
266
+ ...['dk', 'lp', 'tb', 'mb', 'ms'].map(screenConditionRequiresClass),
251
267
  ],
252
268
  'vue/no-template-target-blank': [
253
269
  'error',