@mouse_484/eslint-config 4.3.3 → 4.4.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mouse_484/eslint-config",
3
3
  "type": "module",
4
- "version": "4.3.3",
4
+ "version": "4.4.1",
5
5
  "author": "mouse_484",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/mouse484/config/tree/main/packages/eslint",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@antfu/eslint-config": "^4.14.1",
26
- "eslint-plugin-readable-tailwind": "2.1.2",
26
+ "eslint-plugin-better-tailwindcss": "^3.1.0",
27
27
  "package-manager-detector": "^1.3.0"
28
28
  },
29
29
  "devDependencies": {
@@ -1,9 +1,9 @@
1
1
  import fs from 'node:fs/promises'
2
- import eslintPluginReadableTailwind from 'eslint-plugin-readable-tailwind'
2
+ import eslintPluginBetterTailwindcss from 'eslint-plugin-better-tailwindcss'
3
3
  import { pluginsToRulesDTS } from 'eslint-typegen/core'
4
4
 
5
5
  const dts = await pluginsToRulesDTS({
6
- 'readable-tailwind': eslintPluginReadableTailwind,
6
+ tailwind: eslintPluginBetterTailwindcss,
7
7
  })
8
8
 
9
9
  await fs.writeFile('./src/lib/rules.gen.d.ts', dts)
@@ -1,4 +1,4 @@
1
- import eslintPluginReadableTailwind from 'eslint-plugin-readable-tailwind'
1
+ import eslintPluginBetterTailwindcss from 'eslint-plugin-better-tailwindcss'
2
2
  import { createConfigs } from '../lib/factory.js'
3
3
 
4
4
  export default createConfigs({
@@ -7,18 +7,26 @@ export default createConfigs({
7
7
  configs: [
8
8
  (meta) => {
9
9
  return {
10
- name: 'readable-tailwind',
10
+ name: 'tailwind',
11
11
  plugins: {
12
- 'readable-tailwind': eslintPluginReadableTailwind,
12
+ tailwind: eslintPluginBetterTailwindcss,
13
13
  },
14
14
  rules: {
15
- ...eslintPluginReadableTailwind.configs.warning.rules,
16
- 'readable-tailwind/multiline': ['warn', {
15
+ // stylistic
16
+ 'tailwind/multiline': ['warn', {
17
17
  group: 'newLine',
18
18
  }],
19
+ 'tailwind/no-unnecessary-whitespace': 'warn',
20
+ 'tailwind/sort-classes': 'warn',
21
+ 'tailwind/no-duplicate-classes': 'error',
22
+ 'tailwind/enforce-consistent-variable-syntax': 'error',
23
+ // correctness
24
+ 'tailwind/no-unregistered-classes': 'error',
25
+ 'tailwind/no-conflicting-classes': 'error',
26
+ 'tailwind/no-restricted-classes': 'off',
19
27
  },
20
28
  settings: {
21
- 'readable-tailwind': {
29
+ tailwind: {
22
30
  entryPoint: meta?.entryPoint,
23
31
  },
24
32
  },
@@ -1,3 +1,4 @@
1
+ import { CASES } from '../const/cases.js'
1
2
  import { GLOB_MARKDOWN_CODE_BLOCK, GLOB_README } from '../const/glob.js'
2
3
  import { createConfigs } from '../lib/factory.js'
3
4
 
@@ -32,5 +33,18 @@ export default createConfigs({
32
33
  'unicorn/prevent-abbreviations': 'off',
33
34
  },
34
35
  },
36
+ {
37
+ name: 'react-components',
38
+ withOptions: ['react'],
39
+ files: [
40
+ `**/src/components/**/*.{j,t}sx`,
41
+ ],
42
+ rules: {
43
+ 'unicorn/filename-case': [
44
+ 'error',
45
+ { case: CASES.PascalCase },
46
+ ],
47
+ },
48
+ },
35
49
  ],
36
50
  })
@@ -9,31 +9,128 @@ declare module 'eslint' {
9
9
  }
10
10
 
11
11
  export interface RuleOptions {
12
+ /**
13
+ * Enforce consistent syntax for css variables.
14
+ * @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/enforce-consistent-variable-syntax.md
15
+ */
16
+ 'tailwind/enforce-consistent-variable-syntax'?: Linter.RuleEntry<TailwindEnforceConsistentVariableSyntax>
12
17
  /**
13
18
  * Enforce consistent line wrapping for tailwind classes.
14
- * @see https://github.com/schoero/eslint-plugin-readable-tailwind/blob/main/docs/rules/multiline.md
19
+ * @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/multiline.md
15
20
  */
16
- 'readable-tailwind/multiline'?: Linter.RuleEntry<ReadableTailwindMultiline>
21
+ 'tailwind/multiline'?: Linter.RuleEntry<TailwindMultiline>
22
+ /**
23
+ * Disallow classes that produce conflicting styles.
24
+ * @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-conflicting-classes.md
25
+ */
26
+ 'tailwind/no-conflicting-classes'?: Linter.RuleEntry<TailwindNoConflictingClasses>
17
27
  /**
18
28
  * Disallow duplicate class names in tailwind classes.
19
- * @see https://github.com/schoero/eslint-plugin-readable-tailwind/blob/main/docs/rules/no-duplicate-classes.md
29
+ * @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-duplicate-classes.md
30
+ */
31
+ 'tailwind/no-duplicate-classes'?: Linter.RuleEntry<TailwindNoDuplicateClasses>
32
+ /**
33
+ * Disallow restricted classes.
34
+ * @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-restricted-classes.md
20
35
  */
21
- 'readable-tailwind/no-duplicate-classes'?: Linter.RuleEntry<ReadableTailwindNoDuplicateClasses>
36
+ 'tailwind/no-restricted-classes'?: Linter.RuleEntry<TailwindNoRestrictedClasses>
22
37
  /**
23
38
  * Disallow unnecessary whitespace in tailwind classes.
24
- * @see https://github.com/schoero/eslint-plugin-readable-tailwind/blob/main/docs/rules/no-unnecessary-whitespace.md
39
+ * @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-unnecessary-whitespace.md
40
+ */
41
+ 'tailwind/no-unnecessary-whitespace'?: Linter.RuleEntry<TailwindNoUnnecessaryWhitespace>
42
+ /**
43
+ * Disallow any css classes that are not registered in tailwindcss.
44
+ * @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/no-unregistered-classes.md
25
45
  */
26
- 'readable-tailwind/no-unnecessary-whitespace'?: Linter.RuleEntry<ReadableTailwindNoUnnecessaryWhitespace>
46
+ 'tailwind/no-unregistered-classes'?: Linter.RuleEntry<TailwindNoUnregisteredClasses>
27
47
  /**
28
48
  * Enforce a consistent order for tailwind classes.
29
- * @see https://github.com/schoero/eslint-plugin-readable-tailwind/blob/main/docs/rules/sort-classes.md
49
+ * @see https://github.com/schoero/eslint-plugin-better-tailwindcss/blob/main/docs/rules/sort-classes.md
30
50
  */
31
- 'readable-tailwind/sort-classes'?: Linter.RuleEntry<ReadableTailwindSortClasses>
51
+ 'tailwind/sort-classes'?: Linter.RuleEntry<TailwindSortClasses>
32
52
  }
33
53
 
34
54
  /* ======= Declarations ======= */
35
- // ----- readable-tailwind/multiline -----
36
- type ReadableTailwindMultiline = []|[{
55
+ // ----- tailwind/enforce-consistent-variable-syntax -----
56
+ type TailwindEnforceConsistentVariableSyntax = []|[{
57
+
58
+ callees?: ([]|[string]|[string, string] | []|[string]|[string, ({
59
+
60
+ match?: "strings"
61
+ [k: string]: unknown | undefined
62
+ } | {
63
+
64
+ match?: "objectKeys"
65
+
66
+ pathPattern?: string
67
+ [k: string]: unknown | undefined
68
+ } | {
69
+
70
+ match?: "objectValues"
71
+
72
+ pathPattern?: string
73
+ [k: string]: unknown | undefined
74
+ })[]] | string)[]
75
+
76
+ attributes?: (string | []|[string]|[string, string] | []|[string]|[string, ({
77
+
78
+ match?: "strings"
79
+ [k: string]: unknown | undefined
80
+ } | {
81
+
82
+ match?: "objectKeys"
83
+
84
+ pathPattern?: string
85
+ [k: string]: unknown | undefined
86
+ } | {
87
+
88
+ match?: "objectValues"
89
+
90
+ pathPattern?: string
91
+ [k: string]: unknown | undefined
92
+ })[]])[]
93
+
94
+ variables?: ([]|[string]|[string, string] | []|[string]|[string, ({
95
+
96
+ match?: "strings"
97
+ [k: string]: unknown | undefined
98
+ } | {
99
+
100
+ match?: "objectKeys"
101
+
102
+ pathPattern?: string
103
+ [k: string]: unknown | undefined
104
+ } | {
105
+
106
+ match?: "objectValues"
107
+
108
+ pathPattern?: string
109
+ [k: string]: unknown | undefined
110
+ })[]] | string)[]
111
+
112
+ tags?: ([]|[string]|[string, string] | []|[string]|[string, ({
113
+
114
+ match?: "strings"
115
+ [k: string]: unknown | undefined
116
+ } | {
117
+
118
+ match?: "objectKeys"
119
+
120
+ pathPattern?: string
121
+ [k: string]: unknown | undefined
122
+ } | {
123
+
124
+ match?: "objectValues"
125
+
126
+ pathPattern?: string
127
+ [k: string]: unknown | undefined
128
+ })[]] | string)[]
129
+
130
+ syntax?: ("arbitrary" | "parentheses")
131
+ }]
132
+ // ----- tailwind/multiline -----
133
+ type TailwindMultiline = []|[{
37
134
 
38
135
  callees?: ([]|[string]|[string, string] | []|[string]|[string, ({
39
136
 
@@ -119,8 +216,162 @@ type ReadableTailwindMultiline = []|[{
119
216
 
120
217
  printWidth?: number
121
218
  }]
122
- // ----- readable-tailwind/no-duplicate-classes -----
123
- type ReadableTailwindNoDuplicateClasses = []|[{
219
+ // ----- tailwind/no-conflicting-classes -----
220
+ type TailwindNoConflictingClasses = []|[{
221
+
222
+ callees?: ([]|[string]|[string, string] | []|[string]|[string, ({
223
+
224
+ match?: "strings"
225
+ [k: string]: unknown | undefined
226
+ } | {
227
+
228
+ match?: "objectKeys"
229
+
230
+ pathPattern?: string
231
+ [k: string]: unknown | undefined
232
+ } | {
233
+
234
+ match?: "objectValues"
235
+
236
+ pathPattern?: string
237
+ [k: string]: unknown | undefined
238
+ })[]] | string)[]
239
+
240
+ attributes?: (string | []|[string]|[string, string] | []|[string]|[string, ({
241
+
242
+ match?: "strings"
243
+ [k: string]: unknown | undefined
244
+ } | {
245
+
246
+ match?: "objectKeys"
247
+
248
+ pathPattern?: string
249
+ [k: string]: unknown | undefined
250
+ } | {
251
+
252
+ match?: "objectValues"
253
+
254
+ pathPattern?: string
255
+ [k: string]: unknown | undefined
256
+ })[]])[]
257
+
258
+ variables?: ([]|[string]|[string, string] | []|[string]|[string, ({
259
+
260
+ match?: "strings"
261
+ [k: string]: unknown | undefined
262
+ } | {
263
+
264
+ match?: "objectKeys"
265
+
266
+ pathPattern?: string
267
+ [k: string]: unknown | undefined
268
+ } | {
269
+
270
+ match?: "objectValues"
271
+
272
+ pathPattern?: string
273
+ [k: string]: unknown | undefined
274
+ })[]] | string)[]
275
+
276
+ tags?: ([]|[string]|[string, string] | []|[string]|[string, ({
277
+
278
+ match?: "strings"
279
+ [k: string]: unknown | undefined
280
+ } | {
281
+
282
+ match?: "objectKeys"
283
+
284
+ pathPattern?: string
285
+ [k: string]: unknown | undefined
286
+ } | {
287
+
288
+ match?: "objectValues"
289
+
290
+ pathPattern?: string
291
+ [k: string]: unknown | undefined
292
+ })[]] | string)[]
293
+
294
+ entryPoint?: string
295
+
296
+ tailwindConfig?: string
297
+ }]
298
+ // ----- tailwind/no-duplicate-classes -----
299
+ type TailwindNoDuplicateClasses = []|[{
300
+
301
+ callees?: ([]|[string]|[string, string] | []|[string]|[string, ({
302
+
303
+ match?: "strings"
304
+ [k: string]: unknown | undefined
305
+ } | {
306
+
307
+ match?: "objectKeys"
308
+
309
+ pathPattern?: string
310
+ [k: string]: unknown | undefined
311
+ } | {
312
+
313
+ match?: "objectValues"
314
+
315
+ pathPattern?: string
316
+ [k: string]: unknown | undefined
317
+ })[]] | string)[]
318
+
319
+ attributes?: (string | []|[string]|[string, string] | []|[string]|[string, ({
320
+
321
+ match?: "strings"
322
+ [k: string]: unknown | undefined
323
+ } | {
324
+
325
+ match?: "objectKeys"
326
+
327
+ pathPattern?: string
328
+ [k: string]: unknown | undefined
329
+ } | {
330
+
331
+ match?: "objectValues"
332
+
333
+ pathPattern?: string
334
+ [k: string]: unknown | undefined
335
+ })[]])[]
336
+
337
+ variables?: ([]|[string]|[string, string] | []|[string]|[string, ({
338
+
339
+ match?: "strings"
340
+ [k: string]: unknown | undefined
341
+ } | {
342
+
343
+ match?: "objectKeys"
344
+
345
+ pathPattern?: string
346
+ [k: string]: unknown | undefined
347
+ } | {
348
+
349
+ match?: "objectValues"
350
+
351
+ pathPattern?: string
352
+ [k: string]: unknown | undefined
353
+ })[]] | string)[]
354
+
355
+ tags?: ([]|[string]|[string, string] | []|[string]|[string, ({
356
+
357
+ match?: "strings"
358
+ [k: string]: unknown | undefined
359
+ } | {
360
+
361
+ match?: "objectKeys"
362
+
363
+ pathPattern?: string
364
+ [k: string]: unknown | undefined
365
+ } | {
366
+
367
+ match?: "objectValues"
368
+
369
+ pathPattern?: string
370
+ [k: string]: unknown | undefined
371
+ })[]] | string)[]
372
+ }]
373
+ // ----- tailwind/no-restricted-classes -----
374
+ type TailwindNoRestrictedClasses = []|[{
124
375
 
125
376
  callees?: ([]|[string]|[string, string] | []|[string]|[string, ({
126
377
 
@@ -193,9 +444,10 @@ type ReadableTailwindNoDuplicateClasses = []|[{
193
444
  pathPattern?: string
194
445
  [k: string]: unknown | undefined
195
446
  })[]] | string)[]
447
+ restrict?: string[]
196
448
  }]
197
- // ----- readable-tailwind/no-unnecessary-whitespace -----
198
- type ReadableTailwindNoUnnecessaryWhitespace = []|[{
449
+ // ----- tailwind/no-unnecessary-whitespace -----
450
+ type TailwindNoUnnecessaryWhitespace = []|[{
199
451
 
200
452
  allowMultiline?: boolean
201
453
 
@@ -271,8 +523,8 @@ type ReadableTailwindNoUnnecessaryWhitespace = []|[{
271
523
  [k: string]: unknown | undefined
272
524
  })[]] | string)[]
273
525
  }]
274
- // ----- readable-tailwind/sort-classes -----
275
- type ReadableTailwindSortClasses = []|[{
526
+ // ----- tailwind/no-unregistered-classes -----
527
+ type TailwindNoUnregisteredClasses = []|[{
276
528
 
277
529
  callees?: ([]|[string]|[string, string] | []|[string]|[string, ({
278
530
 
@@ -348,7 +600,88 @@ type ReadableTailwindSortClasses = []|[{
348
600
 
349
601
  entryPoint?: string
350
602
 
351
- order?: ("asc" | "desc" | "official" | "improved")
603
+ tailwindConfig?: string
604
+
605
+ ignore?: string[]
606
+ }]
607
+ // ----- tailwind/sort-classes -----
608
+ type TailwindSortClasses = []|[{
609
+
610
+ callees?: ([]|[string]|[string, string] | []|[string]|[string, ({
611
+
612
+ match?: "strings"
613
+ [k: string]: unknown | undefined
614
+ } | {
615
+
616
+ match?: "objectKeys"
617
+
618
+ pathPattern?: string
619
+ [k: string]: unknown | undefined
620
+ } | {
621
+
622
+ match?: "objectValues"
623
+
624
+ pathPattern?: string
625
+ [k: string]: unknown | undefined
626
+ })[]] | string)[]
627
+
628
+ attributes?: (string | []|[string]|[string, string] | []|[string]|[string, ({
629
+
630
+ match?: "strings"
631
+ [k: string]: unknown | undefined
632
+ } | {
633
+
634
+ match?: "objectKeys"
635
+
636
+ pathPattern?: string
637
+ [k: string]: unknown | undefined
638
+ } | {
639
+
640
+ match?: "objectValues"
641
+
642
+ pathPattern?: string
643
+ [k: string]: unknown | undefined
644
+ })[]])[]
645
+
646
+ variables?: ([]|[string]|[string, string] | []|[string]|[string, ({
647
+
648
+ match?: "strings"
649
+ [k: string]: unknown | undefined
650
+ } | {
651
+
652
+ match?: "objectKeys"
653
+
654
+ pathPattern?: string
655
+ [k: string]: unknown | undefined
656
+ } | {
657
+
658
+ match?: "objectValues"
659
+
660
+ pathPattern?: string
661
+ [k: string]: unknown | undefined
662
+ })[]] | string)[]
663
+
664
+ tags?: ([]|[string]|[string, string] | []|[string]|[string, ({
665
+
666
+ match?: "strings"
667
+ [k: string]: unknown | undefined
668
+ } | {
669
+
670
+ match?: "objectKeys"
671
+
672
+ pathPattern?: string
673
+ [k: string]: unknown | undefined
674
+ } | {
675
+
676
+ match?: "objectValues"
677
+
678
+ pathPattern?: string
679
+ [k: string]: unknown | undefined
680
+ })[]] | string)[]
681
+
682
+ entryPoint?: string
352
683
 
353
684
  tailwindConfig?: string
685
+
686
+ order?: ("asc" | "desc" | "official" | "improved")
354
687
  }]