-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: Introduce @remix-run/eslint-config package
#357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
eb2930b
46a0910
e836865
746e28c
f188f36
821e004
79a3905
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ import globalStylesUrl from "~/styles/global.css"; | |
| import darkStylesUrl from "~/styles/dark.css"; | ||
|
|
||
| // https://remix.run/api/app#links | ||
| export let links = () => { | ||
| export const links = () => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Automatic fix via eslint --fix |
||
| return [ | ||
| { rel: "stylesheet", href: globalStylesUrl }, | ||
| { | ||
|
|
@@ -58,7 +58,7 @@ export function ErrorBoundary({ error }) { | |
|
|
||
| // https://remix.run/api/conventions#catchboundary | ||
| export function CatchBoundary() { | ||
| let caught = useCatch(); | ||
| const caught = useCatch(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Automatic fix via eslint --fix |
||
|
|
||
| let message; | ||
| switch (caught.status) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,13 +2,13 @@ import { Outlet } from "remix"; | |
|
|
||
| import stylesUrl from "~/styles/demos/about.css"; | ||
|
|
||
| export let meta = () => { | ||
| export const meta = () => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Automatic fix via eslint --fix |
||
| return { | ||
| title: "About Remix" | ||
| }; | ||
| }; | ||
|
|
||
| export let links = () => { | ||
| export const links = () => { | ||
| return [{ rel: "stylesheet", href: stylesUrl }]; | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,9 +8,9 @@ export function meta() { | |
| // When your form sends a POST, the action is called on the server. | ||
| // - https://remix.run/api/conventions#action | ||
| // - https://remix.run/guides/data-updates | ||
| export let action = async ({ request }) => { | ||
| let formData = await request.formData(); | ||
| let answer = formData.get("answer"); | ||
| export const action = async ({ request }) => { | ||
| const formData = await request.formData(); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Automatic fix via eslint --fix |
||
| const answer = formData.get("answer"); | ||
|
|
||
| // Typical action workflows start with validating the form data that just came | ||
| // over the network. Clientside validation is fine, but you definitely need it | ||
|
|
@@ -33,8 +33,8 @@ export let action = async ({ request }) => { | |
|
|
||
| export default function ActionsDemo() { | ||
| // https://remix.run/api/remix#useactiondata | ||
| let actionMessage = useActionData(); | ||
| let answerRef = useRef(null); | ||
| const actionMessage = useActionData(); | ||
| const answerRef = useRef(null); | ||
|
|
||
| // This form works without JavaScript, but when we have JavaScript we can make | ||
| // the experience better by selecting the input on wrong answers! Go ahead, disable | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ import { json, useCatch, useLoaderData } from "remix"; | |
| // The `$` in route filenames becomes a pattern that's parsed from the URL and | ||
| // passed to your loaders so you can look up data. | ||
| // - https://remix.run/api/conventions#loader-params | ||
| export let loader = async ({ params }) => { | ||
| export const loader = async ({ params }) => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: Automatic fix via eslint --fix |
||
| // pretend like we're using params.id to look something up in the db | ||
|
|
||
| if (params.id === "this-record-does-not-exist") { | ||
|
|
@@ -38,7 +38,7 @@ export let loader = async ({ params }) => { | |
| }; | ||
|
|
||
| export default function ParamDemo() { | ||
| let data = useLoaderData(); | ||
| const data = useLoaderData(); | ||
| return ( | ||
| <h1> | ||
| The param is <i style={{ color: "red" }}>{data.param}</i> | ||
|
|
@@ -50,7 +50,7 @@ export default function ParamDemo() { | |
| // https://remix.run/api/remix#usecatch | ||
| // https://remix.run/api/guides/not-found | ||
| export function CatchBoundary() { | ||
| let caught = useCatch(); | ||
| const caught = useCatch(); | ||
|
|
||
| let message; | ||
| switch (caught.status) { | ||
|
|
@@ -105,7 +105,7 @@ export function ErrorBoundary({ error }) { | |
| ); | ||
| } | ||
|
|
||
| export let meta = ({ data }) => { | ||
| export const meta = ({ data }) => { | ||
| return { | ||
| title: data ? `Param: ${data.param}` : "Oops..." | ||
| }; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # `@remix-run/eslint-config` | ||
|
|
||
| This package includes a shareable ESLint config for Remix projects. | ||
|
|
||
| This package is new, but eventually we will include it as a dependency in projects bootstrapped with `create-remix` so that no configuration in necessary for those apps. | ||
|
|
||
| ## Installation | ||
|
|
||
| First, install this package along with ESLint in your project. **This package requires at least version 8.1 of ESLint** | ||
|
|
||
| ```sh | ||
| npm install -D eslint @remix-run/eslint-config | ||
| ``` | ||
|
|
||
| Then create a file named `.eslintrc` in the root of your project: | ||
|
|
||
| ```json | ||
| { | ||
| "extends": "@remix-run/eslint-config" | ||
| } | ||
| ``` | ||
|
|
||
| ### Jest | ||
|
|
||
| This packages also ships with optional configuration options for projects that use Jest for testing. To enable these rules, add the following to your `.eslintrc`: | ||
|
|
||
| ```json | ||
| { | ||
| "extends": ["@remix-run/eslint-config", "@remix-run/eslint-config/jest"] | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Automatic fix via eslint --fix