-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy patheslint.config.mjs
114 lines (113 loc) · 3.14 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
110
111
112
113
114
import globals from 'globals';
import eslintTs from 'typescript-eslint';
import importPlugin from 'eslint-plugin-import';
import prettierConfig from 'eslint-config-prettier';
import prettierPlugin from 'eslint-plugin-prettier/recommended';
import monorepoPlugin from 'eslint-plugin-monorepo-cop';
import react from 'eslint-plugin-react';
import eslintJs from '@eslint/js';
import next from '@next/eslint-plugin-next';
/**
* @type {import("eslint").Linter.FlatConfig}
*/
export default eslintTs.config(
eslintJs.configs.recommended,
prettierConfig,
prettierPlugin,
...eslintTs.configs.recommended,
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
{
ignores: [
'**/dist/',
'**/legacy/',
'**/.storybook',
'**/.next',
'**/potentiel-keycloak',
'**/*.config.js',
],
},
{
languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } },
plugins: { import: importPlugin, 'monorepo-cop': monorepoPlugin },
settings: {
'import/parsers': {
espree: ['.js', '.cjs', '.mjs', '.jsx'],
},
},
},
{ files: ['**/*.js'], languageOptions: { sourceType: 'script' } },
{ languageOptions: { globals: globals.browser } },
{
rules: {
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'no-case-declarations': 'off',
'no-empty': ['error', { allowEmptyCatch: true }],
'monorepo-cop/no-relative-import-outside-package': 'error',
'no-restricted-imports': [
'error',
{
patterns: [{ group: ['@potentiel*/**/src/*'], message: 'Use exposed properties' }],
},
],
'import/order': [
'error',
{
'newlines-between': 'always',
pathGroupsExcludedImportTypes: ['builtin'],
groups: ['builtin', 'external', 'internal', 'parent', 'index'],
pathGroups: [
{
pattern: '@potentiel*/**',
group: 'internal',
position: 'before',
},
{
pattern: '@/**',
group: 'parent',
position: 'before',
},
],
},
],
},
},
{
files: ['**/applications/ssr/src/**/*.{ts,tsx}'],
extends: eslintTs.configs.recommended,
plugins: {
...react.configs.flat.recommended.plugins,
'@next/next': next,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
...next.configs.recommended.rules,
...react.configs.flat.recommended.rules,
'@next/next/no-html-link-for-pages': 'off',
'@typescript-eslint/ban-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/no-unescaped-entities': 'off',
'react/prop-types': 'off',
'react/jsx-props-no-spreading': 2,
},
},
// support for chai
{
files: ['**/specifications/src/**/*.ts'],
rules: {
'@typescript-eslint/no-unused-expressions': 'off',
},
},
// allow "any" in tests
{
files: ['**/*.spec.ts'],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
);