-
Notifications
You must be signed in to change notification settings - Fork 1
/
eslint.config.js
104 lines (99 loc) · 2.9 KB
/
eslint.config.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
const templateParser = require('@angular-eslint/template-parser');
const { FlatCompat } = require('@eslint/eslintrc');
const js = require('@eslint/js');
const nxEslintPlugin = require('@nx/eslint-plugin');
const stylistic = require('@stylistic/eslint-plugin');
const eslintConfigPrettier = require('eslint-config-prettier');
const eslintPluginImport = require('eslint-plugin-import');
const unusedImports = require('eslint-plugin-unused-imports');
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
});
module.exports = [
{
plugins: {
'@nx': nxEslintPlugin,
import: eslintPluginImport,
'@stylistic': stylistic,
'unused-imports': unusedImports,
},
},
...compat.config({ extends: ['plugin:@nx/typescript'] }).map((config) => ({
...config,
files: ['**/*.ts', '**/*.tsx'],
})),
...compat.config({ extends: ['plugin:@nx/javascript'] }).map((config) => ({
...config,
files: ['**/*.js', '**/*.jsx'],
})),
...compat.config({ env: { jest: true } }).map((config) => ({
...config,
files: ['**/*.spec.ts', '**/*.spec.tsx', '**/*.spec.js', '**/*.spec.jsx'],
})),
...compat.config({ extends: ['plugin:@nx/angular'] }),
...compat
.config({
extends: ['plugin:@nx/angular-template', 'plugin:@angular-eslint/template/process-inline-templates'],
})
.map((config) => ({
...config,
files: ['**/*.html'],
languageOptions: {
parser: templateParser,
},
rules: {
...config.rules,
// Require equality to be checked with `===` instead of `==`.
// Make an exception for `null` and `undefined` to cover both in a single comparison.
'@angular-eslint/template/eqeqeq': [
'error',
{
allowNullOrUndefined: true,
},
],
},
})),
eslintConfigPrettier,
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
rules: {
// Enforce imports of NX modules to go through the module's entrypoint.
'@nx/enforce-module-boundaries': [
'error',
{
enforceBuildableLibDependency: true,
allow: [],
depConstraints: [
{
sourceTag: '*',
onlyDependOnLibsWithTags: ['*'],
},
],
},
],
// Require imports to be sorted alphabetically.
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
},
],
'sort-imports': 'off',
'no-unused-vars': 'off', // or "@typescript-eslint/no-unused-vars": "off",
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
'warn',
{
vars: 'all',
varsIgnorePattern: '^_',
args: 'after-used',
argsIgnorePattern: '^_',
},
],
},
},
];