3.2.0 • Published 10 months ago
eslint-config-hypothesis v3.2.0
eslint-config-hypothesis
A shareable ESLint configuration for Hypothesis frontend projects.
To use it:
- Add
eslint-config-hypothesisas a dependency to your project - Add the config's peer dependencies (see
peerDependenciesinpackage.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.jsfile 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
/baseentry point, allrecommendedrules from@eslint/jsare enabled and the config assumes that you are using mocha for tests - In
/jsxentry point, allreact.recommended,react.jsx-runtime,react-hooksandjsx-a11y.recommendedrules are enabled, assuming React/Preact is used for any interactive UI - In
/tsentry point, alltypescript-eslint.recommendedrules 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.