@brickflow/lint 0.0.27 → 0.0.28

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.
package/index.js CHANGED
@@ -1,3 +1 @@
1
- import { createLintConfig } from './shared.js'
2
-
3
- export default createLintConfig()
1
+ export { createLintConfig } from './shared.js'
package/package.json CHANGED
@@ -1,13 +1,11 @@
1
1
  {
2
2
  "name": "@brickflow/lint",
3
- "version": "0.0.27",
3
+ "version": "0.0.28",
4
4
  "type": "module",
5
5
  "description": "Shared ESLint configs for brickflow workspaces.",
6
6
  "files": [
7
7
  "index.cjs",
8
8
  "index.js",
9
- "nuxt.cjs",
10
- "nuxt.js",
11
9
  "shared.js",
12
10
  "brick.js",
13
11
  "rules"
@@ -17,11 +15,6 @@
17
15
  "import": "./index.js",
18
16
  "require": "./index.cjs",
19
17
  "default": "./index.js"
20
- },
21
- "./nuxt": {
22
- "import": "./nuxt.js",
23
- "require": "./nuxt.cjs",
24
- "default": "./nuxt.js"
25
18
  }
26
19
  },
27
20
  "scripts": {
@@ -36,13 +29,15 @@
36
29
  "dependencies": {
37
30
  "@eslint/js": "10.0.1",
38
31
  "eslint-config-prettier": "10.1.8",
39
- "eslint-plugin-perfectionist": "5.9.1",
32
+ "eslint-plugin-perfectionist": "5.10.0",
40
33
  "eslint-plugin-prettier": "5.5.6",
41
34
  "eslint-plugin-promise": "7.3.0",
42
35
  "eslint-plugin-regexp": "3.1.1",
43
- "eslint-plugin-vue": "10.9.2",
44
- "globals": "17.7.0",
45
- "typescript-eslint": "8.62.0",
36
+ "eslint-plugin-tailwindcss": "4.2.0",
37
+ "eslint-plugin-unicorn": "72.0.0",
38
+ "eslint-plugin-vue": "10.10.0",
39
+ "globals": "17.9.0",
40
+ "typescript-eslint": "8.65.0",
46
41
  "vue-eslint-parser": "10.4.1"
47
42
  },
48
43
  "peerDependencies": {
@@ -33,7 +33,10 @@ const rule = {
33
33
  create: ({ report }) => ({
34
34
  VariableDeclaration: (node) => {
35
35
  if (node.kind === 'const') {
36
- node.declarations.forEach(({ id: { name }, init }) => {
36
+ for (const {
37
+ id: { name },
38
+ init,
39
+ } of node.declarations) {
37
40
  if (!isUpperCase(name) && isLiteral(init)) {
38
41
  report({ message: messages.upper, node })
39
42
  }
@@ -41,15 +44,16 @@ const rule = {
41
44
  if (isUpperCase(name) && !isLiteral(init) && !isCalleeRequire(init) && !isSpecialChars(name)) {
42
45
  report({ message: messages.lower, node })
43
46
  }
44
- })
45
- }
46
-
47
- if (node.kind === 'let') {
48
- node.declarations.forEach(({ id: { name }, init }) => {
47
+ }
48
+ } else if (node.kind === 'let') {
49
+ for (const {
50
+ id: { name },
51
+ init,
52
+ } of node.declarations) {
49
53
  if (isUpperCase(name) && !isCalleeRequire(init) && !isSpecialChars(name)) {
50
54
  report({ message: messages.lower, node })
51
55
  }
52
- })
56
+ }
53
57
  }
54
58
  },
55
59
  }),
package/shared.js CHANGED
@@ -4,6 +4,8 @@ import perfectionist from 'eslint-plugin-perfectionist'
4
4
  import prettierRecommended from 'eslint-plugin-prettier/recommended'
5
5
  import pluginPromise from 'eslint-plugin-promise'
6
6
  import regexp from 'eslint-plugin-regexp'
7
+ import tailwindcss from 'eslint-plugin-tailwindcss'
8
+ // import unicorn from 'eslint-plugin-unicorn'
7
9
  import pluginVue from 'eslint-plugin-vue'
8
10
  import globals from 'globals'
9
11
  import tseslint from 'typescript-eslint'
@@ -178,6 +180,9 @@ const baseRules = {
178
180
  'promise/prefer-await-to-then': warn,
179
181
  'promise/valid-params': 'error',
180
182
  'require-await': warn,
183
+ 'tailwindcss/no-arbitrary-value': warn,
184
+ 'tailwindcss/no-custom-classname': [warn, { whitelist: ['global-.*'] }],
185
+ 'unicorn/name-replacements': 'off',
181
186
  yoda: 'error',
182
187
  }
183
188
 
@@ -280,7 +285,30 @@ const jsRules = {
280
285
  '@typescript-eslint/no-var-requires': 'off',
281
286
  }
282
287
 
283
- export function createLintConfig({ includeVue = false } = {}) {
288
+ const defaultTailwindcssFunctions = [
289
+ 'classnames',
290
+ 'classNames',
291
+ 'clsx',
292
+ 'cn',
293
+ 'ctl',
294
+ 'cva',
295
+ 'tv',
296
+ 'tw',
297
+ 'twMerge',
298
+ 'twJoin',
299
+ 'defineBrickflowUiConfig',
300
+ ]
301
+
302
+ const defaultTailwindcssIgnoredKeys = ['defaultVariants', 'compoundVariants', 'compoundSlots']
303
+
304
+ export function createLintConfig(options = {}) {
305
+ const {
306
+ includeVue = false,
307
+ tailwindcssConfigPath,
308
+ tailwindcssFunctions = [],
309
+ tailwindcssIgnoredKeys = [],
310
+ tsconfigRootDir: tsconfigRootDirectory = process.cwd(),
311
+ } = options
284
312
  const languageGlobals = includeVue ? { ...globals.browser, ...globals.node } : { ...globals.node }
285
313
 
286
314
  return [
@@ -290,11 +318,29 @@ export function createLintConfig({ includeVue = false } = {}) {
290
318
  perfectionist.configs['recommended-natural'],
291
319
  regexp.configs['flat/recommended'],
292
320
  pluginPromise.configs['flat/recommended'],
321
+ ...(tailwindcssConfigPath
322
+ ? [
323
+ {
324
+ ...tailwindcss.configs.recommended,
325
+ files: ['**/*.{js,mjs,cjs,ts,mts,cts,vue}'],
326
+ settings: {
327
+ tailwindcss: {
328
+ cssConfigPath: tailwindcssConfigPath,
329
+ functions: [...defaultTailwindcssFunctions, ...tailwindcssFunctions],
330
+ ignoredKeys: [...defaultTailwindcssIgnoredKeys, ...tailwindcssIgnoredKeys],
331
+ },
332
+ },
333
+ },
334
+ ]
335
+ : []),
336
+ // unicorn.configs.recommended,
293
337
  prettierRecommended,
294
338
  configPrettier,
295
339
  {
296
340
  plugins: {
297
341
  brick,
342
+ tailwindcss,
343
+ // unicorn,
298
344
  },
299
345
  },
300
346
  {
@@ -303,6 +349,9 @@ export function createLintConfig({ includeVue = false } = {}) {
303
349
  ecmaVersion: 'latest',
304
350
  globals: languageGlobals,
305
351
  parser: tseslint.parser,
352
+ parserOptions: {
353
+ tsconfigRootDir: tsconfigRootDirectory,
354
+ },
306
355
  sourceType: 'module',
307
356
  },
308
357
  rules: baseRules,
@@ -317,6 +366,7 @@ export function createLintConfig({ includeVue = false } = {}) {
317
366
  parser: vueParser,
318
367
  parserOptions: {
319
368
  parser: tseslint.parser,
369
+ tsconfigRootDir: tsconfigRootDirectory,
320
370
  },
321
371
  sourceType: 'module',
322
372
  },
package/nuxt.cjs DELETED
@@ -1 +0,0 @@
1
- module.exports = require('./nuxt.js').default
package/nuxt.js DELETED
@@ -1,3 +0,0 @@
1
- import { createLintConfig } from './shared.js'
2
-
3
- export default createLintConfig({ includeVue: true })