-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.eslintrc.cjs
53 lines (46 loc) · 1.84 KB
/
.eslintrc.cjs
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
'use strict';
/**
* ESLint is really complicated right now, so all of it is abstracted away.
* Updates coming soon (and hopefully to the built-in ember experience).
*/
const { configs } = require('@nullvoxpopuli/eslint-configs');
const config = configs.ember();
const hasTS = (globArray) => globArray.some((glob) => glob.includes('ts'));
// Setup newer TS-aware lints
function addTSProject(override) {
if (!hasTS(override.files)) return override;
return {
...override,
/**
* This is how you tell @typescript-eslint to use your tsconfig.
* However, for gts files, we get this:
*
<repo>/app/components/welcome.gts
0:0 error Parsing error: ESLint was configured to run on
`<tsconfigRootDir>/app/components/welcome.gts/0_<repo>/app/components/welcome.gts/0_<repo>/app/components/welcome.gts/0_<repo>/app/components/welcome.gts`
using `parserOptions.project`: <tsconfigRootDir>/tsconfig.json
However, that TSConfig does not include this file. Either:
- Change ESLint's list of included files to not include this file
- Change that TSConfig to include this file
- Create a new TSConfig that includes this file and include it in your parserOptions.project
This is likely because we need to configure the TS parser to use glint instead of tsc
*/
// parserOptions: {
// ...override.parserOptions,
// extraFileExtensions: [".gts"],
// project: path.join(__dirname, "./tsconfig.json"),
// // TODO: try to set the Glint Program
// // https://typescript-eslint.io/packages/parser/
// // program: import("@glint/core"),
// },
rules: {
...override.rules,
// Disabled until the above issue is resolved
'@typescript-eslint/prefer-optional-chain': 'off',
},
};
}
module.exports = {
...config,
overrides: [...config.overrides].map(addTSProject),
};