-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy patheslint.config.mjs
More file actions
121 lines (113 loc) · 3.64 KB
/
Copy patheslint.config.mjs
File metadata and controls
121 lines (113 loc) · 3.64 KB
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
115
116
117
118
119
120
121
import js from '@eslint/js';
import stylistic from '@stylistic/eslint-plugin';
import { defineConfig, globalIgnores } from 'eslint/config';
import pluginImport from 'eslint-plugin-import';
import pluginReact from 'eslint-plugin-react';
import globals from 'globals';
import tseslint from 'typescript-eslint';
export default defineConfig([
globalIgnores([
'**/lib/',
'**/dist/',
'**/cache/',
'**/node_modules/',
'**/storybook-static',
'**/test-results/',
'**/allure-results/',
'**/.cache/',
'**/__fixtures__/**',
'semcore/table/',
'semcore/stylelint-plugin',
'semcore/illustration/**/*.mjs',
'semcore/illustration/**/*.js',
'semcore/illustration/**/*.d.ts',
'semcore/icon/**/*.mjs',
'semcore/icon/**/*.js',
'semcore/icon/**/*.d.ts',
]),
{ files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], plugins: { js }, extends: ['js/recommended'] },
pluginReact.configs.flat.recommended,
tseslint.configs.recommended,
pluginImport.flatConfigs.recommended,
// { files: ['**/*.{ts,mts,cts,tsx}'], extends: [tseslint.configs.recommended] },
{
files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
languageOptions: { globals: { ...globals.browser, ...globals.node }, ecmaVersion: 'latest', sourceType: 'module' },
},
stylistic.configs.customize({
indent: 2,
quotes: 'single',
semi: true,
commaDangle: 'always-multiline',
arrowParens: 'always',
braceStyle: '1tbs',
}),
{
rules: {
// REACT
'react/prop-types': 'off',
'react/react-in-jsx-scope': 'off',
'react/display-name': 'off',
'react/no-children-prop': 'off',
'react/no-unescaped-entities': 'off',
'react/no-find-dom-node': 'off',
// IMPORTS
'no-restricted-imports': [
'error',
{
paths: [
{
name: 'vitest',
message: 'Please use @semcore/testing-utils/vitest instead of importing from vitest directly.',
},
],
},
],
// TYPESCRIPT
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/semi': 'off', // because of stylistic.semi: true
'@typescript-eslint/consistent-type-imports': 'error',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-this-alias': 'off',
// stylistic
'@stylistic/jsx-quotes': ['error', 'prefer-single'],
'@stylistic/operator-linebreak': ['error', 'after', { overrides: { '?': 'before', ':': 'before' } }],
'@stylistic/jsx-one-expression-per-line': ['error', { allow: 'single-line' }],
'import/order': [
'error',
{
'groups': ['builtin', 'external', 'internal'],
'newlines-between': 'always',
'alphabetize': { order: 'asc', caseInsensitive: true },
},
],
'import/namespace': 'off',
'import/no-unresolved': 'off',
'import/named': 'off',
'import/no-named-as-default': 'off',
'no-console': 'error',
'@typescript-eslint/no-namespace': [
'error',
{
allowDeclarations: true,
},
],
// enable after migration
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'no-empty': 'off',
'no-undef': 'off',
'no-unused-vars': 'off',
'@stylistic/no-mixed-operators': 'off',
'@typescript-eslint/no-unsafe-function-type': 'off',
'no-prototype-builtins': 'off',
},
},
{
files: ['tools/**/*', 'website/**/*', 'stories/**/*', '.ci/**/*', 'semcore/**/__tests__/**/*'],
rules: {
'no-console': 'off',
},
},
]);