eslint-plugin-remix
eslint-plugin-remix copied to clipboard
An ESLint plugin for writing Remix.js Apps
eslint-plugin-remix
An ESLint plugin for Remix
Installing
- Firstly, install the dependency with Yarn
yarn add eslint-plugin-remix --devor with npmnpm install eslint-plugin-remix --save-dev. - Add
remixto your plugins array in your eslint configuration file. - Enable rules by writing
"remix/<rule-name>": "error"in your eslint configuration file.
Rules:
node-server-imports:
Ensures that all imports for known node builtins are only ever used in .server.ts files.
use-loader-data-types:
When using TypeScript, this rule ensures that useLoaderData is passed a generic type of the loader function to explicitly declare what it returns. It is recommended you use this with eslint-plugin-react-hooks.
export const loader = ...;
export default function Home() {
// Ensures that `<typeof loader>` exists here
const data = useLoaderData<typeof loader>();
}