-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.js
More file actions
83 lines (80 loc) · 2.16 KB
/
Copy patheslint.config.js
File metadata and controls
83 lines (80 loc) · 2.16 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
import js from '@eslint/js';
import globals from 'globals';
import reactHooks from 'eslint-plugin-react-hooks';
import reactPlugin from 'eslint-plugin-react';
import tseslint from 'typescript-eslint';
import eslintConfigPrettier from 'eslint-config-prettier';
export default tseslint.config(
{
ignores: [
'dist/**',
'dist-dev/**',
'node_modules/**',
'coverage/**',
'examples/**',
'*.config.js',
'*.config.ts',
],
},
js.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
ecmaVersion: 2020,
globals: {
...globals.browser,
...globals.node,
},
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
'react-hooks': reactHooks,
react: reactPlugin,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
...reactHooks.configs.recommended.rules,
'react/react-in-jsx-scope': 'off',
'react/prop-types': 'off',
// Enforce no hard-coded colors (constitution requirement)
'no-restricted-syntax': [
'error',
{
selector: 'Literal[value=/^#[0-9a-fA-F]{3,8}$/]',
message:
'Hard-coded hex colors are not allowed. Use theme tokens instead.',
},
{
selector:
'Literal[value=/^rgb\\(|^rgba\\(|^hsl\\(|^hsla\\(/]',
message:
'Hard-coded color functions are not allowed. Use theme tokens instead.',
},
],
// Stricter TypeScript rules
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/explicit-function-return-type': [
'error',
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
},
],
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/prefer-nullish-coalescing': 'error',
'@typescript-eslint/prefer-optional-chain': 'error',
},
},
eslintConfigPrettier
);