forked from graphql-hive/graphql-eslint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintrc.js
61 lines (61 loc) · 2.26 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
module.exports = {
reportUnusedDisableDirectives: true,
ignorePatterns: ['examples'],
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'standard', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['unicorn'],
rules: {
'no-empty': 'off',
'no-console': 'error',
'no-prototype-builtins': 'off',
'no-restricted-globals': ['error', { name: 'isNaN', message: 'Use Number.isNaN instead' }],
'no-useless-constructor': 'off',
'object-shorthand': ['error', 'always'],
'no-unused-vars': 'off', // disable base rule as it can report incorrect errors
'@typescript-eslint/no-unused-vars': ['warn', { args: 'none' }],
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'unicorn/prefer-array-some': 'error',
'unicorn/prefer-includes': 'error',
'unicorn/no-useless-fallback-in-spread': 'error',
'unicorn/better-regex': 'error',
'prefer-destructuring': ['error', { object: true }],
quotes: ['error', 'single', { avoidEscape: true }], // Matches Prettier, but also replaces backticks
},
overrides: [
{
files: ['**/rules/*.ts'],
extends: ['plugin:eslint-plugin/rules-recommended'],
rules: {
'eslint-plugin/require-meta-docs-description': ['error', { pattern: '.+\\.$' }], // force to put a point at the end
'eslint-plugin/require-meta-docs-url': [
'error',
{ pattern: 'https://github.com/B2o5T/graphql-eslint/blob/master/docs/rules/{{name}}.md' },
],
},
},
{
files: ['*.{spec,test}.{ts,js}'],
env: {
jest: true,
},
extends: ['plugin:eslint-plugin/tests-recommended'],
rules: {
'eslint-plugin/test-case-shorthand-strings': 'error',
},
},
{
files: ['**/tests/mocks/**/*.{ts,js}'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
},
},
],
};