@react-ddd/eslint-config
v0.4.0
Published
ESLint config for TypeScript or React DDD projects
Downloads
1,224
Maintainers
Readme
@react-ddd/eslint-config
This package is a draconian eslint-config largely based on airbnb and airbnb-typescript. It does NOT use Prettier, instead relying on only one tool to handle code formatting.
Differences from airbnb and airbnb-typescript
react/function-component-definition
Use arrow functions for all components
react/jsx-props-no-spreading
Disable
react/require-default-props
Disable, as we use TypeScript and type the props
@typescript-eslint/comma-dangle
Only in .tsx files Ignore for generics, so that you can have a single unconstrained generic for components:
const GenericComponent<T,> = (...) => {}
@typescript-eslint/brace-style
Disable ignoring single line. ALL braces are required, no single line if's!
@typescript-eslint/consistent-type-imports
Force TypeScript 3.8 style type imports for all types
@typescript-eslint/no-unused-expressions
Error, except for short circuit and ternary
Testing specific rules
There are specific rules for *.spec.tsx?
files to accomodate jest-gwt
style testing:
rules: {
'max-len': [
'error',
{
code: 100,
ignoreUrls: true,
ignoreRegExpLiterals: true,
ignorePattern,
},
],
'react/no-this-in-sfc': 'off',
camelcase: 'off',
'@typescript-eslint/naming-convention': 'off',
'prefer-arrow-callback': 'off',
'func-names': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'no-param-reassign': 'off',
}