@atom.io/eslint-plugin
ESLint rules for atom.io state and transaction declarations.
📖 Read the docs at atom.io.fyi
Install this package as a development dependency alongside ESLint 9 or 10, @typescript-eslint/parser 8, and a supported TypeScript compiler (4.8.4 through 6.0.x).
The TypeScript peer describes the compiler API used by ESLint. You can build with TypeScript 7 alongside it: the starter templates alias TypeScript 7 as @typescript/native for tsc and @typescript/typescript6 as typescript for ESLint's compiler API and the separate tsc6 command.
The exact-catch-types rule requires a TypeScript parser configured with type information. Configure the parser in your ESLint configuration.
The opt-in ban-use-effect rule bans React useEffect in application code while allowing useLayoutEffect. Its diagnostics link to against useEffect and node_modules/atom.io/docs/agent/packages/against-use-effect.md for replacement guidance. See configuration and supported forms.
See the installation guide, configuration exhibit, and rule documentation. When migrating from atom.io/eslint-plugin, change the import to @atom.io/eslint-plugin; the default plugin export, named Rules export, rule names, and options are unchanged.
Install
pnpm add -D @atom.io/eslint-plugin eslint typescript-eslint \
typescript@npm:@typescript/[email protected] \
@typescript/native@npm:[email protected]
Configuration
import atomIO from "@atom.io/eslint-plugin"
import tseslint from "typescript-eslint"
export default tseslint.config(
{
ignores: [`dist/**`, `node_modules/**`],
},
...tseslint.configs.recommendedTypeChecked,
{
files: [`**/*.{ts,tsx}`],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
plugins: {
"atom.io": atomIO,
},
rules: {
"atom.io/exact-catch-types": `error`,
"atom.io/explicit-state-types": `error`,
"atom.io/explicit-transaction-types": `error`,
"atom.io/naming-convention": `error`,
},
},
)
Rules
| Rule | Description |
|---|---|
atom.io/ban-use-effect | Ban React useEffect in atom.io application code |
atom.io/naming-convention | The variable names given to atom.io resources should match their key properties and follow a consistent format |
atom.io/exact-catch-types | Ensures that when an error type (E) is provided to an atom, the 'catch' property is set and all constructors in it are assignable to E. |
atom.io/explicit-state-types | State declarations must have generic type arguments directly passed to them |
atom.io/explicit-transaction-types | Transaction declarations must have generic type arguments directly passed to them |