Skip to content

Commit

Permalink
Lint fix some template files (#5766)
Browse files Browse the repository at this point in the history
* fix: lint fix template files

* fix: update snapshots
  • Loading branch information
jtoar committed Jun 15, 2022
1 parent 4613200 commit 6c43606
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,10 @@ export default PostsLayout
`;
exports[`in javascript (default) mode creates a new component 1`] = `
"import { useMutation } from '@redwoodjs/web'
"import { navigate, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import PostForm from 'src/components/Post/PostForm'
const CREATE_POST_MUTATION = gql\`
Expand Down Expand Up @@ -357,9 +358,10 @@ export default NewPost
`;
exports[`in javascript (default) mode creates a new component with int foreign keys converted in onSave 1`] = `
"import { useMutation } from '@redwoodjs/web'
"import { navigate, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components/UserProfile/UserProfileForm'
const CREATE_USER_PROFILE_MUTATION = gql\`
Expand Down Expand Up @@ -456,9 +458,9 @@ export const Success = ({ post }) => {
exports[`in javascript (default) mode creates a show component 1`] = `
"import humanize from 'humanize-string'
import { Link, routes, navigate } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { Link, routes, navigate } from '@redwoodjs/router'
const DELETE_POST_MUTATION = gql\`
mutation DeletePostMutation($id: Int!) {
Expand Down Expand Up @@ -1010,9 +1012,10 @@ exports[`in javascript (default) mode creates a stylesheet 1`] = `
exports[`in javascript (default) mode creates an edit cell 1`] = `undefined`;
exports[`in javascript (default) mode creates an edit component with int foreign keys converted in onSave 1`] = `
"import { useMutation } from '@redwoodjs/web'
"import { navigate, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components/UserProfile/UserProfileForm'
Expand Down Expand Up @@ -1135,9 +1138,9 @@ export const Success = ({ posts }) => {
exports[`in javascript (default) mode creates an index component 1`] = `
"import humanize from 'humanize-string'
import { Link, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { Link, routes } from '@redwoodjs/router'
import { QUERY } from 'src/components/Post/PostsCell'
Expand Down Expand Up @@ -1665,9 +1668,10 @@ export default PostsLayout
`;
exports[`in typescript mode creates a new component 1`] = `
"import { useMutation } from '@redwoodjs/web'
"import { navigate, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import PostForm from 'src/components/Post/PostForm'
const CREATE_POST_MUTATION = gql\`
Expand Down Expand Up @@ -1710,9 +1714,10 @@ export default NewPost
`;
exports[`in typescript mode creates a new component with int foreign keys converted in onSave 1`] = `
"import { useMutation } from '@redwoodjs/web'
"import { navigate, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components/UserProfile/UserProfileForm'
const CREATE_USER_PROFILE_MUTATION = gql\`
Expand Down Expand Up @@ -1768,6 +1773,7 @@ export default NewPostPage
exports[`in typescript mode creates a show cell 1`] = `
"import type { FindPostById } from 'types/graphql'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import Post from 'src/components/Post/Post'
Expand Down Expand Up @@ -1809,9 +1815,9 @@ export const Success = ({ post }: CellSuccessProps<FindPostById>) => {
exports[`in typescript mode creates a show component 1`] = `
"import humanize from 'humanize-string'
import { Link, routes, navigate } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { Link, routes, navigate } from '@redwoodjs/router'
const DELETE_POST_MUTATION = gql\`
mutation DeletePostMutation($id: Int!) {
Expand Down Expand Up @@ -2353,10 +2359,10 @@ exports[`in typescript mode creates a stylesheet 1`] = `
exports[`in typescript mode creates an edit cell 1`] = `
"import type { EditPostById } from 'types/graphql'
import { navigate, routes } from '@redwoodjs/router'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import PostForm from 'src/components/Post/PostForm'
Expand Down Expand Up @@ -2437,10 +2443,10 @@ export const Success = ({ post }: CellSuccessProps<EditPostById>) => {
exports[`in typescript mode creates an edit component with int foreign keys converted in onSave 1`] = `
"import type { EditUserProfileById } from 'types/graphql'
import { navigate, routes } from '@redwoodjs/router'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components/UserProfile/UserProfileForm'
Expand Down Expand Up @@ -2501,9 +2507,9 @@ export const Success = ({ userProfile }: CellSuccessProps<EditUserProfileById>)
exports[`in typescript mode creates an index cell 1`] = `
"import type { FindPosts } from 'types/graphql'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import { Link, routes } from '@redwoodjs/router'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import Posts from 'src/components/Post/Posts'
Expand Down Expand Up @@ -2556,9 +2562,9 @@ export const Success = ({ posts }: CellSuccessProps<FindPosts>) => {
exports[`in typescript mode creates an index component 1`] = `
"import humanize from 'humanize-string'
import { Link, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { Link, routes } from '@redwoodjs/router'
import { QUERY } from 'src/components/Post/PostsCell'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,10 @@ export default PostsLayout
exports[`in javascript (default) mode creates a new component 1`] = `undefined`;
exports[`in javascript (default) mode creates a new component with int foreign keys converted in onSave 1`] = `
"import { useMutation } from '@redwoodjs/web'
"import { navigate, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components/UserProfileForm'
const CREATE_USER_PROFILE_MUTATION = gql\`
Expand Down Expand Up @@ -413,9 +414,9 @@ export const Success = ({ post }) => {
exports[`in javascript (default) mode creates a show component 1`] = `
"import humanize from 'humanize-string'
import { Link, routes, navigate } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { Link, routes, navigate } from '@redwoodjs/router'
const DELETE_POST_MUTATION = gql\`
mutation DeletePostMutation($id: Int!) {
Expand Down Expand Up @@ -967,9 +968,10 @@ exports[`in javascript (default) mode creates a stylesheet 1`] = `
exports[`in javascript (default) mode creates an edit cell 1`] = `undefined`;
exports[`in javascript (default) mode creates an edit component with int foreign keys converted in onSave 1`] = `
"import { useMutation } from '@redwoodjs/web'
"import { navigate, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components/UserProfileForm'
Expand Down Expand Up @@ -1092,9 +1094,9 @@ export const Success = ({ posts }) => {
exports[`in javascript (default) mode creates an index component 1`] = `
"import humanize from 'humanize-string'
import { Link, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { Link, routes } from '@redwoodjs/router'
import { QUERY } from 'src/components/PostsCell'
Expand Down Expand Up @@ -1624,9 +1626,10 @@ export default PostsLayout
exports[`in typescript mode creates a new component 1`] = `undefined`;
exports[`in typescript mode creates a new component with int foreign keys converted in onSave 1`] = `
"import { useMutation } from '@redwoodjs/web'
"import { navigate, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components/UserProfileForm'
const CREATE_USER_PROFILE_MUTATION = gql\`
Expand Down Expand Up @@ -1682,6 +1685,7 @@ export default NewPostPage
exports[`in typescript mode creates a show cell 1`] = `
"import type { FindPostById } from 'types/graphql'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import Post from 'src/components/Post'
Expand Down Expand Up @@ -1723,9 +1727,9 @@ export const Success = ({ post }: CellSuccessProps<FindPostById>) => {
exports[`in typescript mode creates a show component 1`] = `
"import humanize from 'humanize-string'
import { Link, routes, navigate } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { Link, routes, navigate } from '@redwoodjs/router'
const DELETE_POST_MUTATION = gql\`
mutation DeletePostMutation($id: Int!) {
Expand Down Expand Up @@ -2267,10 +2271,10 @@ exports[`in typescript mode creates a stylesheet 1`] = `
exports[`in typescript mode creates an edit cell 1`] = `
"import type { EditPostById } from 'types/graphql'
import { navigate, routes } from '@redwoodjs/router'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import PostForm from 'src/components/PostForm'
Expand Down Expand Up @@ -2351,10 +2355,10 @@ export const Success = ({ post }: CellSuccessProps<EditPostById>) => {
exports[`in typescript mode creates an edit component with int foreign keys converted in onSave 1`] = `
"import type { EditUserProfileById } from 'types/graphql'
import { navigate, routes } from '@redwoodjs/router'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import UserProfileForm from 'src/components/UserProfileForm'
Expand Down Expand Up @@ -2415,9 +2419,9 @@ export const Success = ({ userProfile }: CellSuccessProps<EditUserProfileById>)
exports[`in typescript mode creates an index cell 1`] = `
"import type { FindPosts } from 'types/graphql'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import { Link, routes } from '@redwoodjs/router'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import Posts from 'src/components/Posts'
Expand Down Expand Up @@ -2470,9 +2474,9 @@ export const Success = ({ posts }: CellSuccessProps<FindPosts>) => {
exports[`in typescript mode creates an index component 1`] = `
"import humanize from 'humanize-string'
import { Link, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { Link, routes } from '@redwoodjs/router'
import { QUERY } from 'src/components/PostsCell'
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/generate/scaffold/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ const addLayoutImport = ({ model: name, path: scaffoldPath = '' }) => {
if (!routesContent.match(importLayout)) {
const newRoutesContent = routesContent.replace(
/['"]@redwoodjs\/router['"](\s*)/,
`'@redwoodjs/router'\n${importLayout}$1`
`'@redwoodjs/router'\n\n${importLayout}$1`
)
writeFile(routesPath, newRoutesContent, { overwriteExisting: true })

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Edit${singularPascalName}ById } from 'types/graphql'

import { navigate, routes } from '@redwoodjs/router'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'

import ${singularPascalName}Form from '${importComponentNameForm}'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import humanize from 'humanize-string'

import { Link, routes, navigate } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { Link, routes, navigate } from '@redwoodjs/router'

const DELETE_${singularConstantName}_MUTATION = gql`
mutation Delete${singularPascalName}Mutation($id: ${idType}!) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Find${singularPascalName}ById } from 'types/graphql'

import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'

import ${singularPascalName} from '${importComponentName}'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import humanize from 'humanize-string'

import { Link, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { Link, routes } from '@redwoodjs/router'

import { QUERY } from '${importComponentNamesCell}'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Find${pluralPascalName} } from 'types/graphql'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'

import { Link, routes } from '@redwoodjs/router'
import type { CellSuccessProps, CellFailureProps } from '@redwoodjs/web'

import ${pluralPascalName} from '${importComponentNames}'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { navigate, routes } from '@redwoodjs/router'
import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'

import ${singularPascalName}Form from '${importComponentNameForm}'

const CREATE_${singularConstantName}_MUTATION = gql`
Expand Down

0 comments on commit 6c43606

Please sign in to comment.