Skip to content

Commit

Permalink
Use TS and JSX shared configs from eslint-config-hypothesis
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Oct 18, 2024
1 parent b72b22f commit 48118ce
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 42 deletions.
44 changes: 8 additions & 36 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -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/**/*',
Expand All @@ -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 `<var> as <type>` 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
{
Expand Down Expand Up @@ -85,4 +57,4 @@ export default tseslint.config(
},
},
},
);
];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 17 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 48118ce

Please sign in to comment.