UNPKG

1.25 kBJavaScriptView Raw
1const config = {
2 extends: ['airbnb', 'prettier'],
3 parserOptions: {
4 ecmaVersion: 8,
5 sourceType: 'module',
6 ecmaFeatures: {
7 jsx: true
8 }
9 },
10 parser: 'typescript-eslint-parser',
11 plugins: ['prettier'],
12 env: {
13 browser: true,
14 node: true
15 },
16 rules: {
17 // Allow use of named functions before declared, they are hoisted and this makes
18 // it possible to declare propTypes at top of component files
19 'no-use-before-define': ['error', { functions: false }],
20
21 // Turn off JSX formatting rules that conflict with auto formatting done by Prettier
22 'react/jsx-closing-bracket-location': 'off',
23 'react/jsx-indent': 'off',
24 'react/jsx-indent-props': 'off',
25 'react/jsx-wrap-multilines': 'off',
26
27 // Airbnb includes eslint-plugin-import, which currently fails to resolve TS
28 // modules. TS lints these modules anways, so turn off these rules.
29 'import/no-unresolved': 'off',
30 'import/extensions': 'off',
31 'import/no-duplicates': 'off'
32 }
33}
34
35// Lint for prettier only in TEST envs
36if (process.env.NODE_ENV === 'TEST') {
37 config.rules['prettier/prettier'] = [
38 'error',
39 { singleQuote: true, printWidth: 84, semi: false, parser: 'typescript' }
40 ]
41}
42
43module.exports = config