Skip to content

Commit a8b16ce

Browse files
committed
fix: simplify eslint config and enable more rules
1 parent 724e9b7 commit a8b16ce

3 files changed

Lines changed: 6 additions & 48 deletions

File tree

eslint.config.mjs

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default tseslint.config(
2828
react.configs.flat['jsx-runtime'],
2929
jsxA11y.flatConfigs.recommended,
3030
importPlugin.flatConfigs.recommended,
31+
eslintPluginUnicorn.configs.recommended,
3132

3233
// Main configuration for all files
3334
{
@@ -54,41 +55,11 @@ export default tseslint.config(
5455
},
5556
},
5657
rules: {
57-
// Accessibility adjustments
58-
'jsx-a11y/click-events-have-key-events': 'warn',
59-
'jsx-a11y/no-static-element-interactions': 'warn',
60-
61-
// Import rules adjustments - disable problematic ones for now
6258
'import/no-unresolved': 'off',
63-
'import/extensions': 'off',
64-
'import/namespace': 'off',
65-
'import/default': 'off',
66-
'import/named': 'off',
67-
'import/no-named-as-default': 'off',
68-
'import/no-named-as-default-member': 'off',
69-
},
70-
},
71-
72-
// Unicorn recommended rules for TypeScript files
73-
{
74-
...eslintPluginUnicorn.configs.recommended,
75-
files: ['**/*.{ts,tsx}'],
76-
},
77-
78-
// Unicorn rule overrides for TypeScript files
79-
{
80-
files: ['**/*.{ts,tsx}'],
81-
rules: {
82-
// Disable overly strict Unicorn rules
8359
'unicorn/filename-case': 'off',
8460
'unicorn/prevent-abbreviations': 'off',
8561
'unicorn/no-null': 'off',
86-
'unicorn/prefer-module': 'off',
87-
'unicorn/prefer-top-level-await': 'off',
88-
'unicorn/no-array-for-each': 'off', // Allow forEach for readability
89-
'unicorn/no-typeof-undefined': 'off',
90-
'unicorn/import-style': 'off',
91-
'unicorn/prefer-node-protocol': 'off',
62+
'unicorn/no-array-for-each': 'off',
9263
},
9364
},
9465

@@ -100,20 +71,6 @@ export default tseslint.config(
10071
},
10172
rules: {
10273
...storybook.configs['flat/recommended'][0].rules,
103-
// Allow more flexible patterns in stories
104-
'unicorn/consistent-function-scoping': 'off',
105-
'unicorn/no-array-reduce': 'off',
106-
},
107-
},
108-
109-
// Test files configuration
110-
{
111-
files: ['**/*.{test,spec}.{ts,tsx}', '**/__tests__/**/*.{ts,tsx}'],
112-
rules: {
113-
// Allow more flexible patterns in tests
114-
'unicorn/consistent-function-scoping': 'off',
115-
'unicorn/no-array-reduce': 'off',
116-
'@typescript-eslint/no-explicit-any': 'off',
11774
},
11875
},
11976

@@ -125,6 +82,7 @@ export default tseslint.config(
12582
'vitest.config.{js,ts}',
12683
'scripts/**/*.js',
12784
'packages/**/build.js',
85+
'packages/docs/babel.config.js',
12886
],
12987
rules: {
13088
'unicorn/prefer-module': 'off',

testSetup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import '@testing-library/jest-dom/vitest'
22

3-
if (typeof HTMLElement.prototype.animate === 'undefined') {
3+
if (HTMLElement.prototype.animate === undefined) {
44
HTMLElement.prototype.animate = vi.fn(() => ({
55
finished: Promise.resolve(),
66
// eslint-disable-next-line @typescript-eslint/no-explicit-any

vitest.root.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { join } from 'path'
1+
import path from 'node:path'
22
import { defineConfig } from 'vitest/config'
33

44
export default defineConfig({
@@ -8,6 +8,6 @@ export default defineConfig({
88
},
99
environment: 'jsdom',
1010
globals: true,
11-
setupFiles: [join(import.meta.dirname, 'testSetup.ts')],
11+
setupFiles: [path.join(import.meta.dirname, 'testSetup.ts')],
1212
},
1313
})

0 commit comments

Comments
 (0)