Skip to content

Commit

Permalink
style: kebabe case file convention
Browse files Browse the repository at this point in the history
  • Loading branch information
pure-js committed Aug 4, 2024
1 parent 1e5e7c8 commit df0d6e5
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 47 deletions.
2 changes: 2 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ parserOptions:
plugins:
- '@typescript-eslint'
- react
- unicorn
rules:
import/prefer-default-export: 'off'
react/jsx-filename-extension: [2, { 'extensions': ['.jsx', '.tsx'] }]
react/require-default-props: 'off'
'@typescript-eslint/explicit-function-return-type': 'off'
'@typescript-eslint/no-floating-promises': 'off'
unicorn/filename-case: ['error', { 'case': 'kebabCase' }]
settings:
'import/resolver':
alias:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-storybook": "^0.6.15",
"eslint-plugin-unicorn": "^55.0.0",
"lightningcss": "^1.22.0",
"msw": "^1.3.3",
"postcss": "^8.4.31",
Expand Down
107 changes: 79 additions & 28 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { useEffect } from 'react';
import { Outlet, useLocation } from 'react-router-dom';
import { GrowthBook, GrowthBookProvider } from '@growthbook/growthbook-react';

import Header from '~/components/Header';
import Alert from '~/components/Alert';
import Breadcrumbs from '~/components/Breadcrumbs';
import Header from '~/components/header';

Check failure on line 5 in src/components/App.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Missing file extension for "~/components/header"
import Alert from '~/components/alert';

Check failure on line 6 in src/components/App.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Missing file extension for "~/components/alert"
import Breadcrumbs from '~/components/breadcrumbs';

Check failure on line 7 in src/components/App.tsx

View workflow job for this annotation

GitHub Actions / lint (20)

Missing file extension for "~/components/breadcrumbs"

// Create a GrowthBook instance
const growthbook = new GrowthBook({
Expand Down
2 changes: 1 addition & 1 deletion src/components/Input.stories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from '@storybook/react';

Check failure on line 1 in src/components/Input.stories.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Filename is not in kebab case. Rename it to `input.stories.ts`

import { Input } from './Input';
import { Input } from './input';

Check failure on line 3 in src/components/Input.stories.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing file extension for "./input"

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react';
import { PostForm } from './PostForm';
import { PostForm } from './post-form';

const meta = {
title: 'Components/PostForm',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react';
import PostPreview from './PostPreview';
import PostPreview from './post-preview';

const meta = {
title: 'Components/PostPreview',
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { createBrowserRouter, RouterProvider, Link } from 'react-router-dom';

import './index.css';

const App = lazy(async () => import('~/components/App'));
const App = lazy(async () => import('~/components/app'));
const Home = lazy(async () => import('~/pages/index'));
const NoMatch = lazy(async () => import('~/pages/[all]'));

const NewPost = lazy(async () => import('~/pages/posts/new'));
const BlogPost = lazy(async () => import('~/pages/posts/[postId]'));
const EditPost = lazy(async () => import('~/pages/posts/[postId]/edit'));
const UserInfo = lazy(async () => import('~/pages/users/[userName]'));
const UserInfo = lazy(async () => import('~/pages/users/[user-name]'));

const root = createRoot(document.getElementById('app'));
const root = createRoot(document.getElementById('app')!);

const router = createBrowserRouter(
[
Expand Down
8 changes: 4 additions & 4 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { Fragment } from 'react';
import { useLiveQuery } from 'dexie-react-hooks';
import { useFeature } from '@growthbook/growthbook-react';

import PostPreview from '~/components/PostPreview';
import Search from '~/components/Search';
import Search from '~/components/search';

import type { IBlogPost } from '~/components/PostPreview';
import { db } from '~/services/db';
import { timestampToLocaleString } from '~/services/timestampToLocaleString';
import { timestampToLocaleString } from '~/services/timestamp-to-locale-string';
import type { IBlogPost } from '~/components/post-preview';
import PostPreview from '~/components/post-preview';

function handleDeleteStory(id: string) {
db.posts.delete(id);
Expand Down
4 changes: 2 additions & 2 deletions src/pages/posts/[postId]/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { useState } from 'react';
import { redirect, useParams } from 'react-router-dom';
import { useLiveQuery } from 'dexie-react-hooks';

import { Input } from '~/components/Input';
import type { IBlogPost } from '~/components/PostPreview';
import { Input } from '~/components/input';
import { db } from '~/services/db';
import type { IBlogPost } from '~/components/PostPreview';

interface IBlogPostProps {
post: IBlogPost;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/posts/[postId]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useNavigate, useParams } from 'react-router-dom';
import { useLiveQuery } from 'dexie-react-hooks';

import type { IBlogPost } from '~/components/PostPreview';
import { db } from '~/services/db';
import type { IBlogPost } from '~/components/PostPreview';

function Post({ heading, text }: IBlogPost) {
const navigate = useNavigate();
Expand Down
Loading

0 comments on commit df0d6e5

Please sign in to comment.