Chore: Setup dependencies

This commit is contained in:
Steven Xu 2021-03-03 18:51:53 -05:00 committed by Aditya Thakral
parent 6e88841397
commit f4d3e9f46f
22 changed files with 6735 additions and 1993 deletions

26
.eslintrc Normal file
View File

@ -0,0 +1,26 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"plugin:import/typescript",
"prettier"
],
"plugins": ["@typescript-eslint", "react", "react-hooks", "import"],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"react/prop-types": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"import/first": "warn",
"import/no-unused-modules": "warn"
},
"settings": {
"react": {
"version": "detect"
}
}
}

1
.gitignore vendored
View File

@ -4,6 +4,7 @@
/node_modules
/.pnp
.pnp.js
.vscode
# testing
/coverage

15
.prettierignore Normal file
View File

@ -0,0 +1,15 @@
node_modules/
.next/
.vercel/
.vscode/snipsnap.code-snippets
public/
.gitignore
.eslintrc
package-lock.json
yarn.lock
.prettierignore
.env
.env.local
LICENSE

View File

@ -0,0 +1,7 @@
import React from "react";
const EditLink: React.FC = () => {
return <div />;
};
export default EditLink;

View File

@ -0,0 +1,7 @@
import React from "react";
const Link: React.FC = () => {
return <div />;
};
export default Link;

View File

@ -0,0 +1,7 @@
import React from "react";
const Preview: React.FC = () => {
return <div />;
};
export default Preview;

3
components/index.ts Normal file
View File

@ -0,0 +1,3 @@
export { default as Link } from "./Link";
export { default as EditLink } from "./EditLink";
export { default as Preview } from "./Preview";

2
next-env.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />

6361
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -5,11 +5,43 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
"start": "next start",
"format": "prettier --write './**/*'",
"format:check": "prettier --check './**/*'",
"lint": "eslint \"{pages,components}/**/*.{js,ts,tsx,jsx}\" --quiet --fix",
"lint:check": "eslint \"{pages,components}/**/*.{js,ts,tsx,jsx}\" --quiet",
"check": "npm run format:check && npm run lint:check",
"check:fix": "npm run format && npm run lint"
},
"dependencies": {
"next": "10.0.7",
"react": "17.0.1",
"react-dom": "17.0.1"
},
"devDependencies": {
"@types/node": "^14.14.31",
"@types/react": "^17.0.2",
"@types/react-dom": "^17.0.1",
"@typescript-eslint/eslint-plugin": "^4.16.1",
"@typescript-eslint/parser": "^4.16.1",
"autoprefixer": "^10.2.4",
"eslint": "^7.21.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^5.1.3",
"postcss": "^8.2.6",
"prettier": "^2.2.1",
"stylelint": "^13.11.0",
"stylelint-config-standard": "^20.0.0",
"tailwindcss": "^2.0.3",
"typescript": "^4.2.2"
},
"husky": {
"hooks": {
"pre-push": "git diff HEAD --quiet && npm run check:fix"
}
}
}

View File

@ -1,7 +0,0 @@
import '../styles/globals.css'
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}
export default MyApp

9
pages/_app.tsx Normal file
View File

@ -0,0 +1,9 @@
import type { AppProps } from "next/app";
import React from "react";
import "styles/globals.css";
const MyApp: React.FC<AppProps> = ({ Component, pageProps }) => (
<Component {...pageProps} />
);
export default MyApp;

View File

@ -1,5 +0,0 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
export default (req, res) => {
res.status(200).json({ name: 'John Doe' })
}

88
pages/editor/index.tsx Normal file
View File

@ -0,0 +1,88 @@
import Head from "next/head";
import React from "react";
import { GetStaticProps } from "next";
import styles from "styles/Home.module.css";
export const getStaticProps: GetStaticProps = async () => {
// TODO: Fetch links here
return {
props: { data: null }, // will be passed to the page component as props
// Next.js will attempt to re-generate the page:
// - When a request comes in
// - At most once every second
revalidate: 1,
};
};
const Editor: React.FC = ({ data }: any) => {
console.log({ data });
return (
// TODO: Remove starter code
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<main className={styles.main}>
<div className="max-w-md mx-auto text-red-600 hover:text-red-700">
<div>
<h1 className={styles.title}>
Welcome to <a href="https://nextjs.org">Next.js!</a>
</h1>
</div>
</div>
<p className={styles.description}>
Get started by editing{" "}
<code className={styles.code}>pages/index.js</code>
</p>
<div className={styles.grid}>
<a href="https://nextjs.org/docs" className={styles.card}>
<h3>Documentation &rarr;</h3>
<p>Find in-depth information about Next.js features and API.</p>
</a>
<a href="https://nextjs.org/learn" className={styles.card}>
<h3>Learn &rarr;</h3>
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>
<a
href="https://github.com/vercel/next.js/tree/master/examples"
className={styles.card}
>
<h3>Examples &rarr;</h3>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
>
<h3>Deploy &rarr;</h3>
<p>
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
</a>
</div>
</main>
<footer className={styles.footer}>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Powered by{" "}
<img src="/vercel.svg" alt="Vercel Logo" className={styles.logo} />
</a>
</footer>
</div>
);
};
export default Editor;

View File

@ -1,8 +1,10 @@
import Head from 'next/head'
import styles from '../styles/Home.module.css'
import Head from "next/head";
import React from "react";
import styles from "styles/Home.module.css";
export default function Home() {
const Login: React.FC = () => {
return (
// TODO: Remove starter code
<div className={styles.container}>
<Head>
<title>Create Next App</title>
@ -10,12 +12,16 @@ export default function Home() {
</Head>
<main className={styles.main}>
<h1 className={styles.title}>
Welcome to <a href="https://nextjs.org">Next.js!</a>
</h1>
<div className="max-w-md mx-auto text-red-600 hover:text-red-700">
<div>
<h1 className={styles.title}>
Welcome to <a href="https://nextjs.org">Next.js!</a>
</h1>
</div>
</div>
<p className={styles.description}>
Get started by editing{' '}
Get started by editing{" "}
<code className={styles.code}>pages/index.js</code>
</p>
@ -56,10 +62,12 @@ export default function Home() {
target="_blank"
rel="noopener noreferrer"
>
Powered by{' '}
Powered by{" "}
<img src="/vercel.svg" alt="Vercel Logo" className={styles.logo} />
</a>
</footer>
</div>
)
}
);
};
export default Login;

84
pages/index.tsx Normal file
View File

@ -0,0 +1,84 @@
import React from "react";
import Head from "next/head";
import { GetStaticProps } from "next";
import styles from "styles/Home.module.css";
export const getStaticProps: GetStaticProps = async () => {
// TODO: Fetch links here
return {
props: { links: [] }, // will be passed to the page component as props
// Next.js will attempt to re-generate the page:
// - When a request comes in
// - At most once every second
revalidate: 1,
};
};
const Home: React.FC = ({ links }: any) => {
console.log({ links });
// TODO: Remove starter code
return (
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<main className={styles.main}>
<h1 className={styles.title}>
Welcome to <a href="https://nextjs.org">Next.js!</a>
</h1>
<p className={styles.description}>
Get started by editing{" "}
<code className={styles.code}>pages/index.js</code>
</p>
<div className={styles.grid}>
<a href="https://nextjs.org/docs" className={styles.card}>
<h3>Documentation &rarr;</h3>
<p>Find in-depth information about Next.js features and API.</p>
</a>
<a href="https://nextjs.org/learn" className={styles.card}>
<h3>Learn &rarr;</h3>
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>
<a
href="https://github.com/vercel/next.js/tree/master/examples"
className={styles.card}
>
<h3>Examples &rarr;</h3>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>
<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
>
<h3>Deploy &rarr;</h3>
<p>
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
</a>
</div>
</main>
<footer className={styles.footer}>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Powered by{" "}
<img src="/vercel.svg" alt="Vercel Logo" className={styles.logo} />
</a>
</footer>
</div>
);
};
export default Home;

7
postcss.config.js Normal file
View File

@ -0,0 +1,7 @@
// postcss.config.js
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

19
stylelint.config.js Normal file
View File

@ -0,0 +1,19 @@
module.exports = {
extends: ["stylelint-config-standard"],
rules: {
"at-rule-no-unknown": [
true,
{
ignoreAtRules: [
"tailwind",
"apply",
"variants",
"responsive",
"screen",
],
},
],
"declaration-block-trailing-semicolon": null,
"no-descending-specificity": null,
},
};

View File

@ -1,16 +1,4 @@
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
a {
color: inherit;
text-decoration: none;
}
* {
box-sizing: border-box;
}
/* ./your-css-folder/styles.css */
@tailwind base;
@tailwind components;
@tailwind utilities;

21
tailwind.config.js Normal file
View File

@ -0,0 +1,21 @@
module.exports = {
purge: {
content: [
"./pages/**/*.{js,ts,jsx,tsx}",
"./components/**/*.{js,ts,jsx,tsx}",
],
// These options are passed through directly to PurgeCSS
options: {
keyframes: true,
fontFace: true,
},
},
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
};

23
tsconfig.json Normal file
View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"allowJs": false /* Allow javascript files to be compiled. */,
"resolveJsonModule": true,
"jsx": "preserve" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
"baseUrl": ".",
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
"strictNullChecks": true /* Enable strict null checks. */,
"skipLibCheck": true,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"lib": ["dom", "dom.iterable", "esnext"],
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"moduleResolution": "node",
"isolatedModules": true
},
"exclude": ["node_modules", "public", ".cache", ".vscode", ".next"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}

1954
yarn.lock

File diff suppressed because it is too large Load Diff