forked from microsoft/FluidFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eslintrc.js
83 lines (77 loc) · 2.62 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
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
module.exports = {
extends: ['@fluidframework/eslint-config-fluid'],
root: true,
rules: {
// TODO: Recover "noUnusedLocals" behavior as part of linting. (This rule seems to be broken in the Fluid repo.)
// '@typescript-eslint/no-unused-vars': ['error', { args: 'none', varsIgnorePattern: '^_' }],
'@typescript-eslint/quotes': [
'error',
'single',
{
allowTemplateLiterals: true,
avoidEscape: true,
},
],
// Intentionally not unifying signatures can enable more scoped API documentation and a better developer experience, which accounts
// for all violations of this rule in this package at the time of writing.
'@typescript-eslint/unified-signatures': 'off',
// Prettier
'comma-dangle': 'off',
'@typescript-eslint/comma-dangle': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'max-len': 'off',
// Rules which could be re-enabled (by dropping these overrides, as they are enabled in base config) with some minor fixes:
'@typescript-eslint/no-shadow': 'off',
'no-shadow': 'off',
// It seems convenient to place schemas and generated files in subfolders
// TODO: Determine if we want to organize them this way
'import/no-internal-modules': [
'error',
{
allow: ['graphql-schemas/*', 'graphql-generated/*', 'graphql/tsutils/Maybe'],
},
],
// unicorn/no-null
// GraphQL uses null rather than undefined. See https://github.com/graphql/graphql-js/issues/1298
// TODO: Determine if we want to use a helper library to convert null to undefined automatically
'unicorn/no-null': 'off',
},
overrides: [
{
files: ['src/test/**'],
rules: {
// Chai assertions trigger the unused expression lint rule.
'@typescript-eslint/no-unused-expressions': 'off',
// Dev dependencies and internal modules may be used in test code
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: true,
},
],
'import/no-internal-modules': 'off',
},
},
{
files: ['**/test/**', 'src/index.ts'],
rules: {
// Test code and the main package export shouldn't be linted for unused exports
'import/no-unused-modules': 'off',
},
},
{
// Files generated by graphql-codegen don't uphold all of the Fluid repo's lint rules.
// TODO: Where possible, customize the codegen output to be compliant.
files: ['src/graphql-generated/**'],
rules: {
'@typescript-eslint/consistent-type-definitions': 'off',
'@typescript-eslint/array-type': 'off',
'import/no-internal-modules': 'off',
},
},
],
};