@will-stone/eslint-config 0.0.9 → 0.1.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @will-stone/eslint-config
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - de8854e: Added support for Tailwind rules.
8
+
9
+ ## 0.0.10
10
+
11
+ ### Patch Changes
12
+
13
+ - 17e3de3: Fixed global ignore patterns (for real this time).
14
+
3
15
  ## 0.0.9
4
16
 
5
17
  ### Patch Changes
package/eslint-config.js CHANGED
@@ -11,6 +11,7 @@ import reactPlugin from 'eslint-plugin-react'
11
11
  import reactHooksPlugin from 'eslint-plugin-react-hooks'
12
12
  import simpleImportSortPlugin from 'eslint-plugin-simple-import-sort'
13
13
  import switchCasePlugin from 'eslint-plugin-switch-case'
14
+ import tailwindPlugin from 'eslint-plugin-tailwindcss'
14
15
  import unicornPlugin from 'eslint-plugin-unicorn'
15
16
  import globals from 'globals'
16
17
  import { globbySync } from 'globby'
@@ -25,12 +26,14 @@ import nodeRules from './rules/node.js'
25
26
  import prettierRules from './rules/prettier.js'
26
27
  import reactRules from './rules/react.js'
27
28
  import switchCaseRules from './rules/switch-case.js'
29
+ import tailwindRules from './rules/tailwind.js'
28
30
  import tsRules from './rules/typescript.js'
29
31
  import unicornRules from './rules/unicorn.js'
30
32
 
31
33
  let testingFramework = null
32
34
  let isNodeEngine = false
33
35
  let isPrettier = false
36
+ let isTailwind = false
34
37
 
35
38
  // In a monorepo environment with one eslint instance at the root of the project,
36
39
  // we must traverse every child package.json to find out if certain dependencies
@@ -65,6 +68,16 @@ for (const packageJsonPath of allPackageJsonPaths) {
65
68
  ) {
66
69
  isPrettier = true
67
70
  }
71
+
72
+ if (
73
+ !isTailwind &&
74
+ Boolean(
75
+ packageJson.dependencies?.tailwindcss ||
76
+ packageJson.devDependencies?.tailwindcss,
77
+ )
78
+ ) {
79
+ isTailwind = true
80
+ }
68
81
  }
69
82
 
70
83
  const isNode =
@@ -73,8 +86,6 @@ const isNode =
73
86
  export default [
74
87
  // Global
75
88
  {
76
- // Common build folders
77
- ignores: ['**/.webpack', '**/dist', '**/.astro'],
78
89
  settings: {
79
90
  react: {
80
91
  version: 'detect',
@@ -82,6 +93,12 @@ export default [
82
93
  },
83
94
  },
84
95
 
96
+ // Global ignore patterns
97
+ {
98
+ // Common build folders
99
+ ignores: ['**/.webpack', '**/dist', '**/.astro'],
100
+ },
101
+
85
102
  // Base
86
103
  {
87
104
  files: ['**/*.{js,cjs,mjs,jsx,ts,tsx}'],
@@ -136,10 +153,12 @@ export default [
136
153
  'jsx-a11y': jsxA11yPlugin,
137
154
  'react': reactPlugin,
138
155
  'react-hooks': reactHooksPlugin,
156
+ ...(isTailwind && { tailwindcss: tailwindPlugin }),
139
157
  },
140
158
  rules: {
141
159
  ...jsxA11yRules,
142
160
  ...reactRules,
161
+ ...(isTailwind && tailwindRules),
143
162
  },
144
163
  },
145
164
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@will-stone/eslint-config",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "description": "Will Stone's ESLint config, using the Flat Config style.",
5
5
  "keywords": [
6
6
  "ESLint"
@@ -33,6 +33,7 @@
33
33
  "eslint-plugin-react-hooks": "^4.6.0",
34
34
  "eslint-plugin-simple-import-sort": "^10.0.0",
35
35
  "eslint-plugin-switch-case": "^1.1.2",
36
+ "eslint-plugin-tailwindcss": "^3.13.0",
36
37
  "eslint-plugin-unicorn": "^48.0.1",
37
38
  "globals": "^13.21.0",
38
39
  "globby": "^13.2.2",
@@ -0,0 +1,9 @@
1
+ export default {
2
+ 'tailwindcss/classnames-order': 'warn',
3
+ 'tailwindcss/enforces-negative-arbitrary-values': 'warn',
4
+ 'tailwindcss/enforces-shorthand': 'warn',
5
+ 'tailwindcss/migration-from-tailwind-2': 'off',
6
+ 'tailwindcss/no-arbitrary-value': 'off',
7
+ 'tailwindcss/no-contradicting-classname': 'warn',
8
+ 'tailwindcss/no-custom-classname': 'error',
9
+ }