Skip to content

Commit

Permalink
feat: eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskang committed Oct 31, 2023
1 parent 29b5d02 commit 822c013
Show file tree
Hide file tree
Showing 19 changed files with 460 additions and 217 deletions.
73 changes: 73 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// const files = ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}']
// const tsFiles = ['**/*.{ts,cts,mts,tsx}']
// const jsxFiles = ['**/*.{jsx,tsx}']
// const testFiles = ['**/*.test.{js,cjs,mjs,jsx,ts,cts,mts,tsx}']

const perfectionistBaseConfig = { type: 'natural' }
module.exports = {
env: {
browser: true,
es2021: true,
jest: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
overrides: [],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'react', 'react-hooks', 'import', 'perfectionist'],
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
// 'simple-import-sort/imports': 'error',
// 'simple-import-sort/exports': 'error',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': ['error', { 'prefer-inline': true }],
'perfectionist/sort-named-exports': ['error', { ...perfectionistBaseConfig }],
'perfectionist/sort-named-imports': ['error', { ...perfectionistBaseConfig }],
'perfectionist/sort-exports': ['error', { ...perfectionistBaseConfig }],
'perfectionist/sort-imports': [
'error',
{
groups: [
'type',
['builtin', 'external'],
'internal-type',
'internal',
['parent-type', 'sibling-type', 'index-type'],
['parent', 'sibling', 'index'],
'object',
'unknown',
],
'custom-groups': {
value: {},
type: {},
},
'newlines-between': 'always',
'internal-pattern': ['~/**'],
...perfectionistBaseConfig,
},
],
},
settings: {
react: {
version: 'detect',
},
'import/resolver': {
node: true,
typescript: true,
},
},
}
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
"typescript.tsdk": "node_modules/typescript/lib",
"references.preferredLocation": "peek",
"tailwindCSS.experimental.configFile": "packages/docs/tailwind.config.cjs",
"eslint.experimental.useFlatConfig": true,
"eslint.format.enable": true
}
File renamed without changes.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
"autoprefixer": "^10.4.16",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-config-standard-with-typescript": "^39.1.1",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-n": "^16.2.0",
"eslint-plugin-perfectionist": "^2.2.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
Expand Down
231 changes: 170 additions & 61 deletions packages/docs/core/App.tsx
Original file line number Diff line number Diff line change
@@ -1,71 +1,180 @@
import { AnchorGroup } from '@zonda/react'
import { useState } from 'react'

import Button from '../pages/Button.mdx'
import { AnchorGroup } from '@zonda/react'

function App() {
const [currKey, setCurrKey] = useState('assadfas')
const onChange = (key: string) => setCurrKey(key)
const onChange = (key: string) => {
setCurrKey(key)
}
return (
<div className="max-w-8xl mx-auto px-4 sm:px-6 md:px-8">
<div className="fixed inset-0 left-[max(0px,calc(50%-45rem))] right-auto top-[3.8125rem] z-20 hidden w-[19rem] overflow-y-auto pb-10 pl-8 pr-6 lg:block ">
<AnchorGroup
selectedKey={currKey}
onChange={onChange}
items={[
{
title: 'Getting Started',
children: [
{
title: 'Installation',
key: '/docs/getting-started/installation',
},
{
title: 'Core Concepts',
key: '/docs/getting-started/core-concepts',
children: [
{ title: 'assadfas', key: 'assadfas' },
{ title: 'assadfas2', key: 'assadfas2' },
{ title: 'assadfas3', key: 'assadfas3' },
],
},
{
title: 'Getting Started',
key: '/docs/getting-started/getting-started',
},
],
},
{
title: 'Array',
children: [
{
title: 'alphabetical',
key: '/docs/array/alphabetical',
},
{
title: 'boil',
key: '/docs/array/boil',
},
{
title: 'cluster',
key: '/docs/array/cluster',
},
{
title: 'counting',
key: '/docs/array/counting',
},
{
title: 'diff',
key: '/docs/array/diff',
},
],
},
]}
/>
<div>
<div className="supports-backdrop-blur:bg-white/60 sticky top-0 z-40 w-full flex-none bg-white/95 backdrop-blur transition-colors duration-500 dark:border-slate-50/[0.06] dark:bg-transparent lg:z-50 lg:border-b lg:border-slate-900/10">
<div className="max-w-8xl mx-auto">
<div className="mx-4 border-b border-slate-900/10 py-4 dark:border-slate-300/10 lg:mx-0 lg:border-0 lg:px-8">
<div className="relative flex items-center">
<a className="mr-3 w-[2.0625rem] flex-none overflow-hidden md:w-auto" href="/">
<span className="sr-only">Tailwind CSS home page</span>
</a>

<div className="relative ml-auto hidden items-center lg:flex">
<nav className="text-sm font-semibold leading-6 text-slate-700 dark:text-slate-200">
<ul className="flex space-x-8">
<li>
<a
className="hover:text-sky-500 dark:hover:text-sky-400"
href="/docs/installation"
>
Docs
</a>
</li>
<li>
<a
className="hover:text-sky-500 dark:hover:text-sky-400"
href="https://tailwindui.com/?ref=top"
>
Components
</a>
</li>
<li>
<a className="hover:text-sky-500 dark:hover:text-sky-400" href="/blog">
Blog
</a>
</li>
<li>
<a className="hover:text-sky-500 dark:hover:text-sky-400" href="/showcase">
Showcase
</a>
</li>
</ul>
</nav>
</div>
<button
className="-my-1 ml-auto flex h-8 w-8 items-center justify-center text-slate-500 hover:text-slate-600 dark:text-slate-400 dark:hover:text-slate-300 lg:hidden"
type="button"
>
<span className="sr-only">Search</span>
<svg
aria-hidden="true"
fill="none"
height="24"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
width="24"
>
<path d="m19 19-3.5-3.5"></path>
<circle cx="11" cy="11" r="6"></circle>
</svg>
</button>
<div className="-my-1 ml-2 lg:hidden">
<button
className="flex h-8 w-8 items-center justify-center text-slate-500 hover:text-slate-600 dark:text-slate-400 dark:hover:text-slate-300"
type="button"
>
<span className="sr-only">Navigation</span>
<svg aria-hidden="true" fill="none" height="24" width="24">
<path
d="M12 6v.01M12 12v.01M12 18v.01M12 7a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm0 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
></path>
</svg>
</button>
</div>
</div>
</div>
<div className="flex items-center border-b border-slate-900/10 p-4 dark:border-slate-50/[0.06] lg:hidden">
<button
className="text-slate-500 hover:text-slate-600 dark:text-slate-400 dark:hover:text-slate-300"
type="button"
>
<span className="sr-only">Navigation</span>
<svg height="24" width="24">
<path
d="M5 6h14M5 12h14M5 18h14"
fill="none"
stroke="currentColor"
strokeLinecap="round"
strokeWidth="2"
></path>
</svg>
</button>
</div>
</div>
</div>
<div className="lg:pl-[19.5rem]">
<div className="mx-auto max-w-3xl pt-10 xl:ml-0 xl:mr-[15.5rem] xl:max-w-none xl:pr-16">
<div className="prose prose-sm flex-1">
<Button />
<div className="max-w-8xl mx-auto flex px-4 sm:px-6 md:px-8">
<div className="fixed inset-0 left-[max(0px,calc(50%-45rem))] right-auto top-[3.8125rem] z-20 hidden w-[19rem] overflow-y-auto pb-10 pl-8 pr-6 lg:block ">
<AnchorGroup
items={[
{
children: [
{
key: '/docs/getting-started/installation',
title: 'Installation',
},
{
children: [
{ key: 'assadfas', title: 'assadfas' },
{ key: 'assadfas2', title: 'assadfas2' },
{ key: 'assadfas3', title: 'assadfas3' },
],
key: '/docs/getting-started/core-concepts',
title: 'Core Concepts',
},
{
key: '/docs/getting-started/getting-started',
title: 'Getting Started',
},
],
title: 'Getting Started',
},
{
children: [
{
key: '/docs/array/alphabetical',
title: 'alphabetical',
},
{
key: '/docs/array/boil',
title: 'boil',
},
{
key: '/docs/array/cluster',
title: 'cluster',
},
{
key: '/docs/array/counting',
title: 'counting',
},
{
key: '/docs/array/diff',
title: 'diff',
},
],
title: 'Array',
},
]}
onChange={onChange}
selectedKey={currKey}
/>
</div>
<div className="lg:pl-[19.5rem] ">
<div className="mx-auto max-w-3xl pt-10 xl:ml-0 xl:mr-[15.5rem] xl:max-w-none xl:pr-16">
<div className="prose prose-sm flex-1">
<Button />
</div>
</div>
</div>
<div className="fixed bottom-0 right-[max(0px,calc(50%-45rem))] top-[3.8125rem] z-20 hidden w-[19.5rem] overflow-y-auto py-10 xl:block">
<div className="px-8">
<h5 className="mb-4 text-sm font-semibold leading-6 text-slate-900 dark:text-slate-100">
On this page
</h5>
</div>
</div>
</div>
Expand Down
41 changes: 0 additions & 41 deletions packages/docs/core/components/DocSidebar.tsx

This file was deleted.

9 changes: 5 additions & 4 deletions packages/docs/core/main.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import './main.css'
import React from 'react'
import ReactDOM from 'react-dom/client'
import React from 'react'

import './main.css'
import App from './App'

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>,
)
</React.StrictMode>
)
Loading

0 comments on commit 822c013

Please sign in to comment.