-
Notifications
You must be signed in to change notification settings - Fork 10
/
.eslintrc.js
132 lines (118 loc) · 4.04 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// @ts-check
/** @type {import('eslint').Linter.Config} */
const config = {
parser: '@typescript-eslint/parser',
parserOptions: {},
// https://twitter.com/TkDodo/status/1667541777585258496
reportUnusedDisableDirectives: true,
extends: [
// /!\ Order matters: the next one overrides rules from the previous one
'plugin:playwright/playwright-test',
'plugin:jest/recommended',
'plugin:unicorn/recommended',
'airbnb-base',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended'
],
plugins: ['simple-import-sort'],
env: {
browser: true
},
rules: {
'no-underscore-dangle': 'off',
'no-plusplus': 'off',
'spaced-comment': 'off',
'lines-between-class-members': 'off',
camelcase: 'off',
'import/no-extraneous-dependencies': 'off',
'import/no-unresolved': 'off',
'import/prefer-default-export': 'off',
'import/extensions': 'off',
'simple-import-sort/imports': [
'error',
{
// https://github.com/lydell/eslint-plugin-simple-import-sort/blob/v7.0.0/src/imports.js#L5
groups: [
// Side effect imports
['^\\u0000'],
// Packages
// Things that start with a letter (or digit or underscore), or `@` followed by a letter
['^@?\\w'],
// Absolute imports and other imports such as Vue-style `@/foo`
// Anything not matched in another group
['^'],
// Relative imports
[
// https://github.com/lydell/eslint-plugin-simple-import-sort/issues/15
// ../whatever/
'^\\.\\./(?=.*/)',
// ../
'^\\.\\./',
// ./whatever/
'^\\./(?=.*/)',
// Anything that starts with a dot
'^\\.',
// .html are not side effect imports
'^.+\\.html$',
// .scss/.css are not side effect imports
'^.+\\.s?css$'
]
]
}
],
'simple-import-sort/exports': 'error',
'no-shadow': 'off',
'@typescript-eslint/no-shadow': 'error',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/class-name-casing': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'unicorn/filename-case': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/catch-error-name': 'off',
'unicorn/prefer-query-selector': 'off',
// FIXME Activate when ES modules are well supported
'unicorn/prefer-module': 'off',
'jest/no-restricted-matchers': 'error'
},
overrides: [
{
files: ['examples/**/*.ts'],
rules: {
'no-console': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'unicorn/prefer-add-event-listener': 'off'
}
},
{
files: ['*.test.ts'],
rules: {
// Disable all Playwright rules if not *.test.e2e.ts
// FIXME https://github.com/eslint/eslint/issues/3419
'playwright/max-nested-describe': 'off',
'playwright/missing-playwright-await': 'off',
'playwright/no-conditional-in-test': 'off',
'playwright/no-element-handle': 'off',
'playwright/no-eval': 'off',
'playwright/no-focused-test': 'off',
'playwright/no-force-option': 'off',
'playwright/no-page-pause': 'off',
'playwright/no-restricted-matchers': 'off',
'playwright/no-skipped-test': 'off',
'playwright/no-useless-not': 'off',
'playwright/no-wait-for-timeout': 'off',
'playwright/prefer-lowercase-title': 'off',
'playwright/prefer-strict-equal': 'off',
'playwright/prefer-to-be': 'off',
'playwright/prefer-to-have-length': 'off',
'playwright/require-top-level-describe': 'off',
'playwright/valid-expect': 'off'
}
}
]
};
module.exports = config;