eslint-config-hypothesis
v3.1.0
Published
A base ESLint configuration for Hypothesis projects
Downloads
3,919
Keywords
Readme
eslint-config-hypothesis
A shareable ESLint configuration for Hypothesis frontend projects.
To use it:
- Add
eslint-config-hypothesis
as a dependency to your project - Add the config's peer dependencies (see
peerDependencies
inpackage.json
) to your project's dependencies. Some of them are required only for some entry points. - Add an ESLint config file to the repository which extends the desired
"hypothesis" config. For example, a
eslint.config.js
file with the following content:import hypothesisBase from 'eslint-config-hypothesis/base'; import hypothesisTS from 'eslint-config-hypothesis/ts'; import hypothesisJSX from 'eslint-config-hypothesis/jsx'; export default [ ...hypothesisBase, ...hypothesisTS, // Optionally add this if the project uses TypeScript ...hypothesisJSX, // Optionally add this if the project uses JSX { // Other project config }, ];
Rule notes
- In
/base
entry point, allrecommended
rules from@eslint/js
are enabled and the config assumes that you are using mocha for tests - In
/jsx
entry point, allreact.recommended
,react.jsx-runtime
,react-hooks
andjsx-a11y.recommended
rules are enabled, assuming React/Preact is used for any interactive UI - In
/ts
entry point, alltypescript-eslint.recommended
rules are enabled - All rules are configured to produce errors and not warnings. This is based on the principle that an issue is either worth fixing or should be ignored, and warnings just add noise
- Code formatting rules that are obsoleted by automated formatters are disabled. You should use Prettier to auto-format code.