forked from govuk-react/govuk-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
107 lines (106 loc) · 2.66 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
const { devDependencies } = require('./package.json');
const { dependencies: gukd } = require('./packages/govuk-react/package.json');
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'no-only-tests'],
extends: [
'airbnb',
'prettier',
'react-app',
'plugin:prettier/recommended',
'plugin:cypress/recommended',
'plugin:import/typescript',
'eslint:recommended',
],
env: {
es6: true,
},
rules: {
'prettier/prettier': ['error'],
'filenames/match-exported': 0,
'jsx-a11y/label-has-associated-control': 0,
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
},
settings: {
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
},
overrides: [
{
files: ['**/*.ts', '**/*.tsx'],
parserOptions: {
project: './tsconfig.json',
},
extends: [
'airbnb',
'airbnb-typescript',
'prettier',
'react-app',
'plugin:prettier/recommended',
'plugin:cypress/recommended',
'plugin:import/typescript',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
],
rules: {
'prettier/prettier': ['error'],
'@typescript-eslint/explicit-module-boundary-types': 'error',
'react/jsx-props-no-spreading': 0,
'filenames/match-exported': 0,
'react/static-property-placement': ['error', 'static public field'],
'jsx-a11y/label-has-associated-control': 0,
},
},
{
files: [
'stories.[jt]s?(x)',
'test.[jt]s?(x)',
'fixtures.[jt]s?(x)',
'**.test.[jt]s?(x)',
'**.spec.[jt]s?(x)',
'example.[jt]s?(x)',
'scripts/**',
'src/stories/**',
],
rules: {
'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
},
settings: {
'import/core-modules': [
'govuk-react',
...Object.keys(devDependencies),
...Object.keys(gukd).filter((dep) => dep.startsWith('@govuk-react/')),
],
},
},
{
files: ['**.test.[jt]s?(x)', '**.spec.[jt]s?(x)'],
rules: {
'no-only-tests/no-only-tests': 'error',
},
},
{
files: ['test.[jt]s?(x)', '**.test.[jt]s?(x)'],
env: {
jest: true,
browser: true,
},
},
{
files: ['stories.[jt]s?(x)', 'src/stories/**'],
rules: {
'import/no-anonymous-default-export': [2, { allowObject: true }],
},
},
],
};