forked from vercel-labs/simorgh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
74 lines (73 loc) · 1.92 KB
/
.eslintrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
const { eslintDirAlias } = require('./dirAlias');
module.exports = {
extends: [
'airbnb',
'plugin:prettier/recommended',
'plugin:jsx-a11y/recommended',
'plugin:cypress/recommended',
],
env: {
es6: true,
browser: true,
jest: true,
node: true,
},
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
ignorePatterns: ['**/tz/**', 'index.stories.jsx', 'index.amp.stories.jsx'],
plugins: ['prettier', 'json', 'jsx-a11y', 'react-hooks', 'cypress', 'import'],
rules: {
'react/forbid-foreign-prop-types': 'error',
'react/jsx-one-expression-per-line': 'off',
'react/jsx-props-no-spreading': 'off',
'linebreak-style': process.platform === 'win32' ? 'off' : ['error', 'unix'],
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'warn',
'import/no-extraneous-dependencies': [
'off',
{
devDependencies: [
'/.storybook/**',
'**/stories.jsx',
'/src/testHelpers/**',
],
},
],
'import/extensions': [1, { json: 'ignorePackages' }],
'jsx-a11y/no-redundant-roles': 'off',
},
settings: {
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
alias: eslintDirAlias,
},
},
overrides: [
{
files: ['**/*.{ts,tsx}'],
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'react/jsx-filename-extension': [
2,
{
extensions: ['.jsx', '.tsx'],
},
],
...{
// adds support for type, interface and enum declarations https://typescript-eslint.io/rules/no-use-before-define/#how-to-use
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['error'],
},
},
},
],
};