Mirror: The spec-compliant minimum of client-side GraphQL.
1module.exports = {
2 parserOptions: {
3 ecmaVersion: 9,
4 sourceType: 'module',
5 ecmaFeatures: {
6 modules: true,
7 },
8 },
9 extends: ['prettier'],
10 plugins: ['prettier', 'tsdoc'],
11 ignorePatterns: ['node_modules/', 'dist/', 'coverage/', 'perf/'],
12 rules: {
13 'no-undef': 'off',
14 'no-empty': 'off',
15 'sort-keys': 'off',
16 'no-console': ['error', { allow: ['warn', 'error'] }],
17 'prefer-arrow/prefer-arrow-functions': 'off',
18 'prefer-rest-params': 'off',
19
20 'prettier/prettier': [
21 'error',
22 {
23 singleQuote: true,
24 tabWidth: 2,
25 printWidth: 100,
26 trailingComma: 'es5',
27 },
28 ],
29 },
30
31 overrides: [
32 {
33 files: ['*.ts'],
34 parser: '@typescript-eslint/parser',
35 extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
36 rules: {
37 '@typescript-eslint/explicit-module-boundary-types': 'off',
38 '@typescript-eslint/no-use-before-define': 'off',
39 '@typescript-eslint/ban-types': 'off',
40 '@typescript-eslint/ban-ts-comment': 'off',
41 '@typescript-eslint/member-ordering': 'off',
42 '@typescript-eslint/explicit-member-accessibility': 'off',
43 '@typescript-eslint/no-object-literal-type-assertion': 'off',
44 '@typescript-eslint/explicit-function-return-type': 'off',
45 '@typescript-eslint/interface-name-prefix': 'off',
46 '@typescript-eslint/no-non-null-assertion': 'off',
47 '@typescript-eslint/no-misused-new': 'off',
48 '@typescript-eslint/no-explicit-any': 'off',
49 '@typescript-eslint/no-unused-vars': 'off',
50 '@typescript-eslint/no-namespace': 'off',
51 '@typescript-eslint/array-type': 'off',
52 'tsdoc/syntax': 'error',
53
54 'no-restricted-syntax': [
55 'error',
56 {
57 selector: 'PropertyDefinition[value]',
58 message: 'Property definitions with value initializers aren’t transpiled',
59 },
60 {
61 selector: 'MemberExpression[optional=true]',
62 message: 'Optional chaining (?.) operator is outside of specified browser support',
63 },
64 {
65 selector: 'LogicalExpression[operator="??"]',
66 message: 'Nullish coalescing (??) operator is outside of specified browser support',
67 },
68 {
69 selector: 'AssignmentExpression[operator="??="]',
70 message: 'Nullish coalescing assignment (??=) is outside of specified browser support',
71 },
72 {
73 selector: ':not(ForStatement) > VariableDeclaration[declarations.length>1]',
74 message: 'Only one variable declarator per variable declaration is preferred',
75 },
76 ],
77
78 '@typescript-eslint/no-import-type-side-effects': 'error',
79 '@typescript-eslint/consistent-type-imports': [
80 'error',
81 {
82 disallowTypeAnnotations: false,
83 fixStyle: 'separate-type-imports',
84 },
85 ],
86 },
87 },
88
89 {
90 files: ['src/**/__tests__/**/*.ts'],
91 rules: {
92 'no-restricted-syntax': 'off',
93 'prefer-rest-params': 'off',
94 },
95 },
96
97 {
98 files: ['**/*.d.ts'],
99 rules: {
100 '@typescript-eslint/triple-slash-reference': 'off',
101 },
102 },
103 ],
104};