-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheslint.config.js
More file actions
80 lines (78 loc) · 3.13 KB
/
Copy patheslint.config.js
File metadata and controls
80 lines (78 loc) · 3.13 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
/**
* ObjectUI
* Copyright (c) 2024-present ObjectStack Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import objectUi from './eslint-rules/index.js'
export default tseslint.config({
ignores: [
'**/dist',
'**/.next',
'**/node_modules',
'**/public',
// fumadocs-mdx codegen for apps/site (gitignored — see apps/site/.gitignore).
// Linting generated output only reports on the generator's choices.
'**/.source',
// Tailwind configs are authored in TypeScript despite the `.js` extension,
// and the TS parser below is scoped to `.ts`/`.tsx`, so the base JS parser
// would fail on `import type`. Build config, not app code.
'**/tailwind.config.js',
],
}, {
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
'object-ui': objectUi,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-explicit-any': 'warn',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
// Downgrade new React Compiler rules to warnings (codebase predates these rules)
'react-hooks/refs': 'warn',
'react-hooks/immutability': 'warn',
'react-hooks/set-state-in-effect': 'warn',
'react-hooks/preserve-manual-memoization': 'warn',
'react-hooks/use-memo': 'warn',
// ADR-0054 Phase 5 ratchet — ban synthetic-event triggers (C1). Error so a
// new violation fails CI; the existing surfaces were converted to direct
// idempotent commands first, so this lints clean today.
'object-ui/no-synthetic-event-trigger': 'error',
// objectui#2879 ratchet — a hook called inside try/catch desyncs hook order
// when the catch swallows a throw. #2595/#2596 fixed this in the canonical
// createSafeTranslation; nine plugin-local copies kept it until #2879.
// Error so a tenth copy fails CI; all known sites were converted first, so
// this lints clean today.
'object-ui/no-try-catch-around-hook': 'error',
},
}, {
// Type-discipline ratchet, scoped to the canonical view-schema file: a
// spec-backed view-config field must reference its @objectstack/spec type,
// never redefine it inline (a hand mirror silently drifts from the spec →
// "shipped-but-inert" metadata). Scoped here to avoid false positives on
// unrelated `selection`/`pagination`/… fields elsewhere. Error so a new
// inline mirror fails CI; the covered fields were converted first, so this
// lints clean today.
files: ['packages/types/src/objectql.ts'],
plugins: { 'object-ui': objectUi },
rules: {
'object-ui/no-inline-spec-config': 'error',
},
});