-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
87 lines (81 loc) · 2.97 KB
/
index.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
const {
JSX_AND_TSX,
resolvePathArray,
} = require('@nightgrey/eslint-config-utils');
const typescriptEslintParser = require('@typescript-eslint/parser');
const typescriptEslintPlugin = require('@typescript-eslint/eslint-plugin');
const airbnbTypescript = require('eslint-config-airbnb-typescript');
const airbnbTypescriptRules = resolvePathArray(airbnbTypescript.extends);
const typescriptEslintPluginRules = {
// eslint-disable-next-line import/no-named-as-default-member -- CJS
...typescriptEslintPlugin.configs.base.rules,
// eslint-disable-next-line import/no-named-as-default-member -- CJS
...typescriptEslintPlugin.configs['recommended-requiring-type-checking']
.rules,
};
/**
* TypeScript configuration
*
* @type {import('eslint').Linter.FlatConfig}
*/
module.exports.typescriptBase = {
languageOptions: {
parser: typescriptEslintParser,
// Compatibility layer until flat configuration support
parserOptions: {
// eslint-disable-next-line import/no-named-as-default-member -- CJS
...typescriptEslintPlugin.configs.base.parserOptions,
},
},
rules: {
...typescriptEslintPluginRules,
...airbnbTypescriptRules,
// Disable `no-underscore-dangle`. Use `@typescript-eslint/naming-convention` instead.
// https://eslint.org/docs/latest/rules/no-underscore-dangle
'no-underscore-dangle': ['off'],
// Disables unsafe member access and assignment because it seems to catch
// more false positives than positives. Not sure why yet.
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unsafe-assignment.md
// https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-unsafe-member-access.md
'@typescript-eslint/no-unsafe-assignment': ['off'],
'@typescript-eslint/no-unsafe-member-access': ['off'],
// // Define naming conventions for variables, functions, etc.
// // https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/naming-convention.md
// '@typescript-eslint/naming-convention': [
// 'error',
// {
// selector: 'objectLiteralProperty',
// format: undefined,
// },
// {
// selector: 'default',
// format: ['camelCase', 'PascalCase'],
// leadingUnderscore: 'allowSingleOrDouble',
// trailingUnderscore: 'allow',
// },
// {
// selector: 'variable',
// format: ['PascalCase', 'camelCase', 'UPPER_CASE'],
// leadingUnderscore: 'allowSingleOrDouble',
// trailingUnderscore: 'allow',
// },
// {
// selector: 'typeLike',
// format: ['PascalCase'],
// },
// ],
},
plugins: {
'@typescript-eslint': typescriptEslintPlugin,
},
settings: {
'import/parsers': {
'@typescript-eslint/parser': JSX_AND_TSX.map(
(extension) => `.${extension}`
),
},
'import/resolver': {
typescript: {},
},
},
};