-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheslint.config.js
More file actions
188 lines (175 loc) · 5.16 KB
/
Copy patheslint.config.js
File metadata and controls
188 lines (175 loc) · 5.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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import { includeIgnoreFile } from '@eslint/compat'
import js from '@eslint/js'
import perfectionist from 'eslint-plugin-perfectionist'
import svelte from 'eslint-plugin-svelte'
import unicorn from 'eslint-plugin-unicorn'
import { defineConfig } from 'eslint/config'
import globals from 'globals'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import ts from 'typescript-eslint'
import svelteConfig from './svelte.config.js'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const gitignorePath = path.resolve(__dirname, '.gitignore')
export default defineConfig(
perfectionist.configs['recommended-natural'],
js.configs.recommended,
ts.configs.recommended,
unicorn.configs.recommended,
svelte.configs.recommended,
svelte.configs.prettier,
{
languageOptions: {
globals: {
...globals.browser,
...globals.node,
},
},
},
includeIgnoreFile(gitignorePath),
{
// houserules-owned files, refreshed by `npx houserules update`
ignores: [
'**/.claude/agents/**',
'.claude/houserules.config.json',
'.claude/houserules.manifest.json',
'**/.claude/ledgers/**',
'**/.claude/plans/**',
'**/.claude/scripts/**',
'.claude/settings.ci.json',
'**/.claude/skills/**',
'**/.claude/templates/**',
],
},
{
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
languageOptions: {
parserOptions: {
extraFileExtensions: ['.svelte'],
parser: ts.parser,
projectService: true,
svelteConfig,
},
},
},
{
name: 'viam/base',
rules: {
'no-useless-assignment': 'off',
},
},
{
name: 'viam/svelte/svelte-base',
rules: {
// Off because this currently has false positives
'svelte/prefer-svelte-reactivity': 'off',
},
},
{
name: 'viam/perfectionist',
rules: {
'perfectionist/sort-array-includes': 'off',
'perfectionist/sort-classes': 'off',
'perfectionist/sort-decorators': 'off',
'perfectionist/sort-enums': 'off',
'perfectionist/sort-export-attributes': 'off',
'perfectionist/sort-exports': 'off',
'perfectionist/sort-heritage-clauses': 'off',
'perfectionist/sort-interfaces': 'off',
'perfectionist/sort-intersection-types': 'off',
'perfectionist/sort-jsx-props': 'off',
'perfectionist/sort-maps': 'off',
'perfectionist/sort-modules': 'off',
'perfectionist/sort-named-exports': 'off',
'perfectionist/sort-object-types': 'off',
'perfectionist/sort-objects': 'off',
'perfectionist/sort-sets': 'off',
'perfectionist/sort-switch-case': 'off',
'perfectionist/sort-union-types': 'off',
'perfectionist/sort-variable-declarations': 'off',
'perfectionist/sort-imports': [
'error',
{
internalPattern: [String.raw`^\$`],
},
],
},
},
{
name: 'viam/unicorn',
rules: {
'unicorn/consistent-function-scoping': 'off',
'unicorn/custom-error-definition': 'error',
'unicorn/escape-case': 'off',
'unicorn/filename-case': 'off',
'unicorn/no-for-loop': 'off',
'unicorn/no-hex-escape': 'off',
'unicorn/no-null': 'off',
'unicorn/no-object-as-default-parameter': 'off',
'unicorn/no-process-exit': 'off',
'unicorn/no-unused-properties': 'error',
'unicorn/no-useless-undefined': 'off',
'unicorn/number-literal-case': 'off',
'unicorn/numeric-separators-style': 'off',
'unicorn/prefer-add-event-listener': 'off',
'unicorn/prefer-blob-reading-methods': 'off',
'unicorn/prefer-code-point': 'off',
'unicorn/prefer-modern-math-apis': 'off',
'unicorn/prefer-string-replace-all': 'error',
'unicorn/prefer-switch': 'off',
'unicorn/prefer-top-level-await': 'off',
'unicorn/prevent-abbreviations': 'off',
'unicorn/require-module-specifiers': 'off',
'unicorn/prefer-global-this': 'off',
'unicorn/no-nested-ternary': 'off',
// TODO
// 'unicorn/filename-case': [
// 'error',
// {
// cases: {
// camelCase: true,
// pascalCase: true,
// },
// },
// ],
},
},
{
name: 'viam/no-barrel-imports',
files: ['src/lib/**'],
// The barrels themselves, which legitimately re-export their own directory.
ignores: ['src/lib/index.ts', 'src/lib/lib.ts', 'src/lib/plugins/index.ts'],
rules: {
'no-restricted-imports': [
'error',
{
paths: [
{
name: '$lib',
message:
"Import the module directly (e.g. '$lib/components/overlay/Portals/DashboardPortal.svelte'). '$lib' re-exports App.svelte, so reaching for it from inside src/lib creates a core <-> plugin import cycle.",
},
{
name: '$lib/lib',
message:
"Import the module directly (e.g. '$lib/loaders/pcd'). '$lib/lib' is a published entry point, not for internal use.",
},
{
name: '$lib/plugins',
message:
"Import the plugin module directly (e.g. '$lib/plugins/Logs/useLogs.svelte'). The barrel pulls in every plugin, including ControlWidgets, which imports @viamrobotics/test-widgets and closes an import cycle back into this package.",
},
],
patterns: [
{
group: ['$lib/index*', '$lib/lib.*', '$lib/plugins/index*'],
message:
'Barrel import spelled via its index file. Import the module directly instead.',
},
],
},
],
},
}
)