-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
89 lines (86 loc) · 2.06 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: [
'airbnb-typescript',
'airbnb/hooks',
'plugin:@typescript-eslint/recommended',
'plugin:sonarjs/recommended',
'prettier',
'prettier/@typescript-eslint',
'prettier/react',
],
plugins: ['@typescript-eslint', 'react', 'prettier', 'jsx-a11y', 'sonarjs'],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.eslint.json',
},
env: {
es6: true,
browser: true,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'prettier/prettier': 'error',
// NextJS doesn't require react in scope
'react/react-in-jsx-scope': 'off',
/**
* NextJS <Link> API conflicts with a11y expectations
* https://github.com/zeit/next.js/issues/5533
* https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/402
**/
'jsx-a11y/anchor-is-valid': [
'error',
{
components: ['Link'],
specialLink: ['hrefLeft', 'hrefRight'],
aspects: ['invalidHref', 'preferButton'],
},
],
// Un-opinionate airbnb a bit
'arrow-body-style': 'off',
'no-console': 'off',
'max-classes-per-file': 'off',
},
globals: {
React: 'writable',
},
// TODO: doesn't want to play nice with ts parser
ignorePatterns: ['.eslintrc.js'],
overrides: [
{
// TypeScript + JSX
files: ['**/*.tsx'],
rules: {
// https://github.com/yannickcr/eslint-plugin-react/issues/2353
'react/prop-types': 'off',
},
},
{
// Config files
files: ['.eslintrc.js', '*.config.js', 'next.config.js'],
env: { node: true },
parserOptions: { sourceType: 'script' },
rules: {
'@typescript-eslint/no-var-requires': ['off'],
},
},
{
// Tests
files: ['src/test/**', '**/*.test.{ts,tsx}'],
env: { jest: true },
rules: {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true, // ie. allowed
},
],
},
},
],
};