forked from y-scope/eslint-config-yscope
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTsConfigArray.mjs
More file actions
80 lines (73 loc) · 2.17 KB
/
TsConfigArray.mjs
File metadata and controls
80 lines (73 loc) · 2.17 KB
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
import ImportPlugin from "eslint-plugin-import";
import TsEslint from "typescript-eslint";
/**
* Gets an object containing the basic options to configure ESLint for a TypeScript project.
*
* @param {string[]} files Paths or globs for the TypeScript files to be linted.
* @param {string} projectConfigPath Path to the corresponding `tsconfig.json`.
* @return {object} The configuration object.
*/
const createTsConfigOverride = (files, projectConfigPath) => ({
files: files,
languageOptions: {
parserOptions: {project: projectConfigPath},
},
settings: {
"import/resolver": {
typescript: {
project: projectConfigPath,
},
},
},
});
const TsConfigArray = [
...TsEslint.configs.strictTypeChecked,
ImportPlugin.flatConfigs.typescript,
{
languageOptions: {
parser: TsEslint.parser,
parserOptions: {
project: "tsconfig.json",
},
},
plugins: {
"@typescript-eslint": TsEslint.plugin,
},
rules: {
"jsdoc/check-types": ["off"],
"jsdoc/no-types": ["warn"],
"jsdoc/require-param-type": ["off"],
"jsdoc/require-property-type": ["off"],
"jsdoc/require-returns-type": ["off"],
"no-restricted-syntax": ["off"],
"no-shadow": ["off"],
"@typescript-eslint/member-ordering": ["error"],
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-unnecessary-boolean-literal-compare": ["off"],
"@typescript-eslint/restrict-template-expressions": [
"error",
{
allowNumber: true,
},
],
},
settings: {
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: "tsconfig.json",
},
},
},
},
].map(
(config) => ({
files: [
"**/*.ts",
"**/*.tsx",
],
...config,
})
);
export {createTsConfigOverride};
export default TsConfigArray;