Skip to content

feat: Introduce @remix-run/eslint-config package#357

Merged
ryanflorence merged 7 commits intodevfrom
chance/eslint
Dec 9, 2021
Merged

feat: Introduce @remix-run/eslint-config package#357
ryanflorence merged 7 commits intodevfrom
chance/eslint

Conversation

@chaance
Copy link
Copy Markdown
Contributor

@chaance chaance commented Nov 1, 2021

This PR creates a new package for providing simple ESLint support for new Remix projects. The goal is to be as unopinionated as possible while enabling rules that either deal with bugs or optimization. Like the rules for create-react-app, I also included an optional config for projects that use Jest.

In general, these rules are even less opinionated than the react-app config; we enable a subset of the rules they use and leave the rest up to users. Eventually I'd also like to create our own ESLint plugin that catches issues specific to Remix.

I have not updated create-remix to include this package/config by default, but would like to do that in a follow-up PR once this is merged.

Comment thread package.json Outdated
TransitionRedirect
TransitionRedirect,
IDLE_FETCHER,
IDLE_TRANSITION
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consolidating duplicate import statements. Caught by using these new rules!

Comment thread packages/remix-eslint-config/index.js Outdated
@ryanflorence
Copy link
Copy Markdown
Member

This is for remix source code or for remix apps?

@chaance
Copy link
Copy Markdown
Contributor Author

chaance commented Nov 2, 2021

@ryanflorence Apps, though I used it for our source config as well mostly as a way to quickly test that everything works as expected.

At the moment it's pretty limited in scope. What I envision is creating an additional package @remix-run/eslint-plugin that we include in our config that would add linting rules for Remix (ex., calling useLoaderData in a route without a loader). But the early version just ensures that new Remix apps have a basic standard ESLint setup since pretty much everyone is going to want to set that up anyway.

@kentcdodds kentcdodds force-pushed the dev branch 2 times, most recently from ab9dac4 to 172ecc9 Compare December 2, 2021 06:15
remixContext
) {
let markup = renderToString(
const markup = renderToString(
Copy link
Copy Markdown
Contributor Author

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


// https://remix.run/api/app#links
export let links = () => {
export const links = () => {
Copy link
Copy Markdown
Contributor Author

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

// https://remix.run/api/conventions#catchboundary
export function CatchBoundary() {
let caught = useCatch();
const caught = useCatch();
Copy link
Copy Markdown
Contributor Author

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

import stylesUrl from "~/styles/demos/about.css";

export let meta = () => {
export const meta = () => {
Copy link
Copy Markdown
Contributor Author

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

let formData = await request.formData();
let answer = formData.get("answer");
export const action = async ({ request }) => {
const formData = await request.formData();
Copy link
Copy Markdown
Contributor Author

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

// 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 }) => {
Copy link
Copy Markdown
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants