forked from devonfw/devon4ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheslint.config.cjs
97 lines (95 loc) · 2.3 KB
/
eslint.config.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
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
88
89
90
91
92
93
94
95
96
97
const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const eslintPluginPrettier = require('eslint-plugin-prettier');
const eslintConfigPrettier = require('eslint-config-prettier');
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
module.exports = [
{
ignores: ['**/dist', 'src/lib/**/files/**/*', '**/src/lib/**/files/**/*', '**/*.d.ts', '**/*.d.ts'],
},
{
plugins: {
'@nx': nxEslintPlugin,
'prettier': eslintPluginPrettier,
},
},
{
files: ['**/*.json'],
// Override or add rules here
rules: {},
languageOptions: {
parser: require('jsonc-eslint-parser'),
},
},
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
rules: {
'@nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
allow: [],
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*'],
},
],
},
],
},
},
...compat
.config({
extends: ['plugin:@nx/typescript'],
})
.map(config => ({
...config,
files: ['**/*.ts', '**/*.tsx', '**/*.cts', '**/*.mts'],
rules: {
...config.rules,
'no-console': 'error',
'@typescript-eslint/explicit-function-return-type': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'prettier/prettier': 'error',
'sort-imports': [
'error',
{
allowSeparatedGroups: false,
ignoreDeclarationSort: true,
ignoreMemberSort: true,
},
],
},
})),
...compat
.config({
extends: ['plugin:@nx/javascript'],
})
.map(config => ({
...config,
files: ['**/*.js', '**/*.jsx', '**/*.cjs', '**/*.mjs'],
rules: {
...config.rules,
},
})),
...compat
.config({
env: {
jest: true,
},
})
.map(config => ({
...config,
files: ['**/*.spec.ts', '**/*.spec.tsx', '**/*.spec.js', '**/*.spec.jsx'],
rules: {
...config.rules,
},
})),
eslintConfigPrettier,
];