Skip to content

Commit

Permalink
feat(examples): fix basic lint (#5775)
Browse files Browse the repository at this point in the history
  • Loading branch information
tknickman authored Aug 22, 2023
1 parent b6c9dc5 commit cb6105a
Show file tree
Hide file tree
Showing 27 changed files with 1,774 additions and 654 deletions.
10 changes: 0 additions & 10 deletions examples/basic/.eslintrc.js

This file was deleted.

3 changes: 1 addition & 2 deletions examples/basic/apps/docs/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = {
root: true,
extends: ["custom"],
extends: ["eslint-config-custom/next"],
};
2 changes: 1 addition & 1 deletion examples/basic/apps/docs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
}): JSX.Element {
return (
<html lang="en">
<body>{children}</body>
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/apps/docs/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button, Header } from "ui";

export default function Page() {
export default function Page(): JSX.Element {
return (
<>
<Header text="Docs" />
Expand Down
3 changes: 1 addition & 2 deletions examples/basic/apps/web/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = {
root: true,
extends: ["custom"],
extends: ["eslint-config-custom/next"],
};
2 changes: 1 addition & 1 deletion examples/basic/apps/web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
}): JSX.Element {
return (
<html lang="en">
<body>{children}</body>
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/apps/web/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Button, Header } from "ui";

export default function Page() {
export default function Page(): JSX.Element {
return (
<>
<Header text="Web" />
Expand Down
3 changes: 2 additions & 1 deletion examples/basic/apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"lint": "next lint"
},
"dependencies": {
"next": "^13.4.1",
"next": "^13.4.19",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ui": "workspace:*"
},
"devDependencies": {
"@next/eslint-plugin-next": "^13.4.19",
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
Expand Down
9 changes: 4 additions & 5 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
"format": "prettier --write \"**/*.{ts,tsx,md}\""
},
"devDependencies": {
"@turbo/gen": "^1.9.7",
"eslint": "^7.32.0",
"eslint-config-custom": "workspace:*",
"prettier": "^2.5.1",
"turbo": "^1.9.7"
"eslint": "^8.47.0",
"prettier": "^3.0.2",
"tsconfig": "workspace:*",
"turbo": "^1.10.12"
},
"packageManager": "pnpm@8.6.10"
}
11 changes: 0 additions & 11 deletions examples/basic/packages/eslint-config-custom/index.js

This file was deleted.

15 changes: 0 additions & 15 deletions examples/basic/packages/eslint-config-custom/package.json

This file was deleted.

3 changes: 3 additions & 0 deletions examples/basic/packages/eslint-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `@turbo/eslint-config`

Collection of internal eslint configurations.
34 changes: 34 additions & 0 deletions examples/basic/packages/eslint-config/library.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const { resolve } = require("node:path");

const project = resolve(process.cwd(), "tsconfig.json");

/*
* This is a custom ESLint configuration for use with
* typescript packages.
*
* This config extends the Vercel Engineering Style Guide.
* For more information, see https://github.com/vercel/style-guide
*
*/

module.exports = {
extends: [
"@vercel/style-guide/eslint/node",
"@vercel/style-guide/eslint/typescript",
].map(require.resolve),
parserOptions: {
project,
},
globals: {
React: true,
JSX: true,
},
settings: {
"import/resolver": {
typescript: {
project,
},
},
},
ignorePatterns: ["node_modules/", "dist/"],
};
41 changes: 41 additions & 0 deletions examples/basic/packages/eslint-config/next.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
const { resolve } = require("node:path");

const project = resolve(process.cwd(), "tsconfig.json");

/*
* This is a custom ESLint configuration for use with
* Next.js apps.
*
* This config extends the Vercel Engineering Style Guide.
* For more information, see https://github.com/vercel/style-guide
*
*/

module.exports = {
extends: [
"@vercel/style-guide/eslint/typescript",
"@vercel/style-guide/eslint/browser",
"@vercel/style-guide/eslint/react",
"@vercel/style-guide/eslint/next",
"eslint-config-turbo",
].map(require.resolve),
parserOptions: {
project,
},
globals: {
React: true,
JSX: true,
},
settings: {
"import/resolver": {
typescript: {
project,
},
},
},
ignorePatterns: ["node_modules/", "dist/"],
// add rules configurations here
rules: {
"import/no-default-export": "off",
},
};
10 changes: 10 additions & 0 deletions examples/basic/packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "eslint-config-custom",
"license": "MIT",
"version": "0.0.0",
"private": true,
"devDependencies": {
"@vercel/style-guide": "^4.0.2",
"eslint-config-turbo": "^1.10.12"
}
}
39 changes: 39 additions & 0 deletions examples/basic/packages/eslint-config/react-internal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const { resolve } = require("node:path");

const project = resolve(process.cwd(), "tsconfig.json");

/*
* This is a custom ESLint configuration for use with
* internal (bundled by their consumer) libraries
* that utilize React.
*
* This config extends the Vercel Engineering Style Guide.
* For more information, see https://github.com/vercel/style-guide
*
*/

module.exports = {
extends: [
"@vercel/style-guide/eslint/browser",
"@vercel/style-guide/eslint/typescript",
"@vercel/style-guide/eslint/react",
].map(require.resolve),
parserOptions: {
project,
},
globals: {
JSX: true,
},
settings: {
"import/resolver": {
typescript: {
project,
},
},
},
ignorePatterns: ["node_modules/", "dist/", ".eslintrc.js"],
// add rules configurations here
rules: {
"import/no-default-export": "off",
},
};
3 changes: 2 additions & 1 deletion examples/basic/packages/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true
"strict": true,
"strictNullChecks": true
},
"exclude": ["node_modules"]
}
3 changes: 3 additions & 0 deletions examples/basic/packages/ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ["eslint-config-custom/react-internal"],
};
7 changes: 0 additions & 7 deletions examples/basic/packages/ui/Button.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions examples/basic/packages/ui/Header.tsx

This file was deleted.

10 changes: 10 additions & 0 deletions examples/basic/packages/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"use client";

export function Button(): JSX.Element {
return (
// eslint-disable-next-line no-alert
<button onClick={(): void => alert("booped")} type="button">
Boop
</button>
);
}
3 changes: 3 additions & 0 deletions examples/basic/packages/ui/header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function Header({ text }: { text: string }): JSX.Element {
return <h1>{text}</h1>;
}
6 changes: 2 additions & 4 deletions examples/basic/packages/ui/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from "react";

// component exports
export * from "./Button";
export * from "./Header";
export * from "./button";
export * from "./header";
5 changes: 3 additions & 2 deletions examples/basic/packages/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
"types": "./index.tsx",
"license": "MIT",
"scripts": {
"lint": "eslint \"**/*.ts*\"",
"lint": "eslint .",
"generate:component": "turbo gen react-component"
},
"devDependencies": {
"@turbo/gen": "^1.10.12",
"@types/node": "^20.5.2",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"eslint": "^7.32.0",
"eslint-config-custom": "workspace:*",
"react": "^18.2.0",
"tsconfig": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/packages/ui/turbo/generators/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PlopTypes } from "@turbo/gen";
import type { PlopTypes } from "@turbo/gen";

// Learn more about Turborepo Generators at https://turbo.build/repo/docs/core-concepts/monorepos/code-generation

Expand All @@ -22,7 +22,7 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void {
{
type: "append",
path: "index.tsx",
pattern: /(\/\/ component exports)/g,
pattern: /(?<insertion>\/\/ component exports)/g,
template: 'export * from "./{{pascalCase name}}";',
},
],
Expand Down
Loading

1 comment on commit cb6105a

@vercel
Copy link

@vercel vercel bot commented on cb6105a Aug 22, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

examples-basic-web – ./examples/basic/apps/web

turborepo-examples-basic-web.vercel.sh
examples-basic-web-git-main.vercel.sh
examples-basic-web.vercel.sh

Please sign in to comment.