-
Notifications
You must be signed in to change notification settings - Fork 4
/
eslint.config.mjs
65 lines (58 loc) · 1.57 KB
/
eslint.config.mjs
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
// Don't enable @ts-check yet because `generateEslintConfig` doesn't ship with
// TypeScript declaration support.
import { generateEslintConfig } from '@companion-module/tools/eslint/config.mjs'
const baseConfig = await generateEslintConfig({
enableJest: true,
enableTypescript: true,
ignores: [
// Legacy JS files are being refactored out of existence, so skip them.
'src/api.js',
'src/instance.js',
],
})
/**
* @param {import('eslint').Linter.Config<import('eslint').Linter.RulesRecord>['files']} files
* @param {readonly string[]} allowModules
* @returns {import('eslint').Linter.Config<import('eslint').Linter.RulesRecord>}
*/
function permitLimitedUnpublishedImports(files, allowModules) {
return {
files,
rules: {
'n/no-unpublished-import': [
'error',
{
allowModules,
},
],
},
}
}
const customConfig = [
...baseConfig,
{
ignores: ['eslint.config.*'],
rules: {
'n/no-missing-import': 'off',
'n/no-unpublished-import': 'error',
'@typescript-eslint/strict-boolean-expressions': 'error',
eqeqeq: 'error',
radix: 'error',
'no-eval': 'error',
'no-implied-eval': 'error',
'@typescript-eslint/consistent-type-imports': [
'error',
{
fixStyle: 'inline-type-imports',
},
],
},
},
permitLimitedUnpublishedImports(
['src/**/*spec.ts', 'src/**/*test.ts', 'src/**/__tests__/*', 'src/**/__mocks__/*'],
['@jest/globals'],
),
permitLimitedUnpublishedImports(['eslint.config.mjs'], ['@companion-module/tools']),
permitLimitedUnpublishedImports(['jest.config.ts'], ['ts-jest']),
]
export default customConfig