-
Notifications
You must be signed in to change notification settings - Fork 12
/
eslint.config.js
79 lines (78 loc) · 2.11 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
import tidal from 'eslint-config-tidal';
import disableAutofix from 'eslint-plugin-disable-autofix';
import jsdoc from 'eslint-plugin-jsdoc';
/** @type { import("eslint").Linter.Config[] } */
export default [
...tidal,
{
files: [
'*.js',
'packages/*/src/**/*.ts',
'packages/*/test/*/*.ts',
'packages/*/*.ts',
'packages/*/*.js',
'packages/*/demo/*.js',
'packages/*/examples/*.js',
],
languageOptions: {
parserOptions: {
projectService: {
allowDefaultProject: ['*.js', 'demo/*.js', 'examples/*.js'],
defaultProject: 'tsconfig.json',
},
},
},
},
{
ignores: [
'node_modules/*',
'packages/*/node_modules/*',
'packages/*/dist/*',
'packages/**/*.generated.ts',
'coverage',
'packages/*/coverage',
],
},
{
plugins: {
'disable-autofix': disableAutofix,
jsdoc,
},
rules: {
'@typescript-eslint/no-restricted-types': [
'warn',
{
types: {
null: "Use 'undefined' instead of 'null', or better yet '?' optional syntax",
},
},
],
'disable-autofix/jsdoc/require-description': 'error',
'disable-autofix/jsdoc/require-jsdoc': 'warn', // disable-autofix makes sure the normal jsdoc rule doesn't auto-add empty comments to pass the rule
'jsdoc/tag-lines': ['warn', 'any', { startLines: 1 }],
// prevent unnecessary imports and also importing stuff from happydom breaks vitest in a bad way
'no-restricted-imports': [
'error',
{
patterns: ['vitest', 'happydom'],
},
],
'no-restricted-syntax': [
'error',
{
message: 'Never use Date.now! always use trueTime.now()',
selector:
'CallExpression[callee.object.name="Date"][callee.property.name="now"]',
},
],
},
},
// ignore some rules for eslint/vite config files
{
files: ['packages/*/vite*config.*s', 'eslint.config.js'],
rules: {
'import/no-default-export': 'off',
'no-restricted-imports': 'off',
},
},
];