diff --git a/eslint.config.js b/eslint.config.js index abed0375..f2831dfb 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,9 +1,9 @@ -import hypothesis from 'eslint-config-hypothesis'; -import jsxA11y from 'eslint-plugin-jsx-a11y'; +import hypothesisBase from 'eslint-config-hypothesis/base'; +import hypothesisJSX from 'eslint-config-hypothesis/jsx'; +import hypothesisTS from 'eslint-config-hypothesis/ts'; import globals from 'globals'; -import tseslint from 'typescript-eslint'; -export default tseslint.config( +export default [ { ignores: [ '.tox/**/*', @@ -16,38 +16,10 @@ export default tseslint.config( 'via/static/js/**', ], }, - ...hypothesis, - ...tseslint.configs.recommended, - jsxA11y.flatConfigs.recommended, - { - rules: { - 'prefer-arrow-callback': 'error', - 'prefer-const': ['error', { destructuring: 'all' }], - - // Props are checked by TS. - 'react/prop-types': 'off', - - // Upgrade TS rules from warning to error. - '@typescript-eslint/no-unused-vars': 'error', - // Disable TS rules that we dislike. - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/no-empty-function': 'off', - '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-this-alias': 'off', - - // Enforce consistency in cases where TypeScript supports old and new - // syntaxes for the same thing. - // - // - Require ` as ` for casts - // - Require `import type` for type imports. The corresponding rule for - // exports is not enabled yet because that requires setting up type-aware - // linting. - '@typescript-eslint/consistent-type-assertions': 'error', - '@typescript-eslint/consistent-type-imports': 'error', - }, - }, + ...hypothesisBase, + ...hypothesisJSX, + ...hypothesisTS, // Icons { @@ -85,4 +57,4 @@ export default tseslint.config( }, }, }, -); +]; diff --git a/package.json b/package.json index 588e3cbb..27764b20 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "enzyme": "^3.11.0", "enzyme-adapter-preact-pure": "^4.1.0", "eslint": "^9.12.0", - "eslint-config-hypothesis": "^3.0.0", + "eslint-config-hypothesis": "^3.1.0", "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-mocha": "^10.5.0", "eslint-plugin-react": "^7.37.1", diff --git a/yarn.lock b/yarn.lock index 732d21fe..6516c48c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5106,14 +5106,26 @@ __metadata: languageName: node linkType: hard -"eslint-config-hypothesis@npm:^3.0.0": - version: 3.0.0 - resolution: "eslint-config-hypothesis@npm:3.0.0" +"eslint-config-hypothesis@npm:^3.1.0": + version: 3.1.0 + resolution: "eslint-config-hypothesis@npm:3.1.0" peerDependencies: + eslint-plugin-jsx-a11y: ">=6.10.0" eslint-plugin-mocha: ">=10.4.0" eslint-plugin-react: ">=7.34.0" eslint-plugin-react-hooks: ">=5.0.0" - checksum: 1194156f2d043ed866afe9ccd88d7364cdf8635cb9d762d24beffb03ee02a25d44081b58d95c5b1a658e686053948d8b2493e65f4de540e14d72ae83c35c31fe + globals: ">=15.11.0" + typescript-eslint: ">=8.10.0" + peerDependenciesMeta: + eslint-plugin-jsx-a11y: + optional: true + eslint-plugin-react: + optional: true + eslint-plugin-react-hooks: + optional: true + typescript-eslint: + optional: true + checksum: 12e17da643a306fec1c8121bf5f172f2132f816d85b2b6f626dc16d353f5cbac8bee0cce080a9df829c5eab3e4bcc007bb611ec6f5d9deebd627e530802c05f6 languageName: node linkType: hard @@ -10377,7 +10389,7 @@ __metadata: enzyme: ^3.11.0 enzyme-adapter-preact-pure: ^4.1.0 eslint: ^9.12.0 - eslint-config-hypothesis: ^3.0.0 + eslint-config-hypothesis: ^3.1.0 eslint-plugin-jsx-a11y: ^6.10.0 eslint-plugin-mocha: ^10.5.0 eslint-plugin-react: ^7.37.1