-
Notifications
You must be signed in to change notification settings - Fork 307
/
Copy patheslint.config.mjs
109 lines (106 loc) · 3.62 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
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
105
106
107
108
109
import { createRequire } from 'node:module';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { FlatCompat } from '@eslint/eslintrc';
import eslint from '@eslint/js';
import angularEslint from 'angular-eslint';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import importPlugin from 'eslint-plugin-import';
import jestPlugin from 'eslint-plugin-jest';
import jsdocPlugin from 'eslint-plugin-jsdoc';
import globals from 'globals';
import tseslint from 'typescript-eslint';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: eslint.configs.recommended,
allConfig: eslint.configs.all,
});
const eslintPluginPrettier = compat.extends('plugin:prettier/recommended');
const createRequireESM = createRequire(import.meta.url);
const prettierConfig = createRequireESM('./.prettierrc.json');
export default tseslint.config(
{
ignores: [
'**/dist',
'**/node_modules',
'**/coverage',
'**/build',
'**/.yarn',
'website/.docusaurus',
'src/transformers/jit_transform.js',
],
},
eslint.configs.recommended,
tseslint.configs.strict,
importPlugin.flatConfigs.recommended,
jestPlugin.configs['flat/recommended'],
eslintConfigPrettier,
eslintPluginPrettier,
{
files: ['**/*.{js,cjs,mjs}'],
languageOptions: {
globals: {
...globals.node,
globalThis: false,
},
},
rules: {
'@typescript-eslint/no-require-imports': 'off',
},
},
{
files: ['**/*.ts', '**/*.tsx'],
extends: [importPlugin.flatConfigs.recommended, importPlugin.flatConfigs.typescript],
rules: {
'@typescript-eslint/no-require-imports': 'off',
'jest/no-conditional-expect': 'off',
'import/default': 'off',
},
},
{
files: ['**/*.{js,cjs,mjs,ts,mts,cts,tsx}'],
plugins: {
jsdoc: jsdocPlugin,
},
rules: {
'@typescript-eslint/no-extraneous-class': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'import/no-unresolved': 'off',
'import/order': [
'error',
{
alphabetize: {
order: 'asc',
caseInsensitive: true,
},
// this is the default order except for added `internal` in the middle
groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index'],
'newlines-between': 'always',
},
],
'no-unused-vars': 'off',
'padding-line-between-statements': ['error', { blankLine: 'always', prev: '*', next: 'return' }],
'prettier/prettier': [
'error',
{
...prettierConfig,
tabWidth: 4,
},
],
},
},
{
files: ['examples/**/*.ts'],
extends: [...angularEslint.configs.tsRecommended],
processor: angularEslint.processInlineTemplates,
rules: {
'@angular-eslint/component-class-suffix': 'off',
'@angular-eslint/component-selector': 'off',
'@angular-eslint/directive-selector': 'off',
'@angular-eslint/no-input-rename': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
);