Cratis Arc proxies — configure ESLint
Cratis Arc’s generated TypeScript clients can be linted with your application or skipped with the Arc ESLint processor. Choose the policy in your frontend configuration, not by editing generated files: handwritten fixes can be lost the next time the generator writes them.
Lint with your application policy
Section titled “Lint with your application policy”If you lint generated files, allow their exported empty interfaces, including interfaces that inherit members but declare none of their own. These are public API shapes that support declaration merging and existing assignability. Configure the applicable @typescript-eslint/no-empty-interface and @typescript-eslint/no-empty-object-type policies to permit them.
Generated output contains no blanket ESLint disable directives or @ts-ignore comments. Keep reportUnusedDisableDirectives at error; permitting an interface shape does not require a waiver for unused directives. Generated response hooks supply their response generic rather than suppressing a type error.
Application checks for license headers, named import-member sorting and TypeScript-comment bans can remain active. Import members are sorted without reordering imported modules. Match header requirements through the generator’s file header configuration, rather than adding a header by hand.
Your other rules may need configuration too. For example, React hook rules can flag generated static .use() methods as hook calls inside a class. If keeping generated output under your lint policy is not useful, use the processor below; it leaves handwritten source available for linting.
Skip generated files
Section titled “Skip generated files”Skipping generated files keeps lint findings focused on source you maintain. Fix a generated-file finding in the generator or consumer configuration, not in the output file.
Generated .ts proxies carry a // @generated by Cratis metadata line and a **DO NOT EDIT** banner. Generation follows CratisProxiesOutputPath, not the build configuration: Release builds can regenerate output too. Unchanged inputs or matching generated content can be skipped, but this is not a promise to preserve handwritten edits.
Configure the skip processor
Section titled “Configure the skip processor”@cratis/eslint-plugin-arc ships a skip-generated-proxies processor that skips recognized generated files wholesale. Its recommended configuration applies the processor to .ts files and uses file content rather than folder names to recognize proxies. This avoids maintaining a path allow-list, including when generated and handwritten files share a folder.
Recognition accepts a first-line // @generated by Cratis marker, or a fourth-line marker after the standard Cratis copyright line, license line and blank third line. A marker inside an authored multiline template literal does not qualify. The processor also recognizes the generated **DO NOT EDIT** banner within the first four lines. If you customize file headers, keep these recognition limits in mind; the processor does not search the whole file for a marker.
Skipping lint does not make a shared output folder safe. Prefer the dedicated, generator-owned directory described in getting started, and check output behavior before mixing files.
Install
Section titled “Install”yarn add -D @cratis/eslint-plugin-arc @cratis/eslint-config eslintimport cratis from '@cratis/eslint-config';import arc from '@cratis/eslint-plugin-arc';
export default [ ...cratis.configs.consumer, ...arc.configs.recommended, // …your project rules];With arc.configs.recommended composed in, recognized generated .ts files supply no content for ESLint to lint, including formatting rules run through ESLint. This does not exclude them from a separate formatter or the frontend’s TypeScript compilation.
Other rules in the plugin
Section titled “Other rules in the plugin”The recommended configuration also enables two rules for handwritten code. These apply to .ts and .tsx files and matter if you use model-view-viewmodel (MVVM) classes or MobX:
| Rule | What it does |
|---|---|
no-hooks-in-view-model |
Disallows React hook calls inside classes named *ViewModel by default. Keep the view model React-free and inject a Cratis abstraction instead. |
no-direct-mobx-react-import |
Disallows direct imports from mobx-react/mobx-react-lite. Import observer from @cratis/arc.react.mvvm, which re-exports the binding. |
no-hooks-in-view-model takes options to fit a project’s own naming conventions:
'@cratis/arc/no-hooks-in-view-model': ['error', { classSuffix: 'ViewModel', // class-name suffix that marks a view model hookPattern: '^use[A-Z]', // bare-identifier calls treated as hooks additionalHooks: ['injectQuery'], // extra call names to forbid}]Only bare-identifier calls (useState(...)) are flagged — a member call like this.useDefaults() is not, so a view-model method that merely starts with use is safe.
See also
Section titled “See also”- File Index Tracking explains the
// @generated by Cratismetadata and whyindex.tsdeliberately does not carry it.