Skip to content

Commit

Permalink
ESLint 9 + compatibility check (#335)
Browse files Browse the repository at this point in the history
* WIP

* Use ESLint 9

* feat: setup compatibility check pipeline

* fix: master -> main

* fix: enable corepack before node setup

* fix: install dependencies

* chore: test / sanity check

* fix: fail-fast to false for more information

* chore: revert sanity-check

* chore: Migration guide in readme

* chore: have renovate respect tests

* chore: remove Node 18 from compatibility

* chore: remove ESLint 8 from compatibility

* fix: wrap config ourselves, clean up migration guide, etc

* update peer deps

* move compat from devDeps to deps

lockfile

* formatting

* update mode

* fixup eslint-plugin-react-hooks

* pin versions in bootstrap script

* bump deps

* bump version

---------

Co-authored-by: Julian Schleemann <[email protected]>
  • Loading branch information
mvarendorff2 and Julian Schleemann authored Oct 8, 2024
1 parent 2d9a22c commit 82a92d0
Show file tree
Hide file tree
Showing 37 changed files with 2,212 additions and 679 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/check-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Check compatibility"

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
check-compatibility:
name: 'Check compatibility'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [20, 22]
eslint: [9]

steps:
- uses: actions/checkout@v4

- name: Enable corepack
run: corepack enable

- uses: actions/setup-node@v4
name: Setup node
with:
cache: pnpm
node-version: ${{ matrix.node }}

- name: Install dependencies
run: pnpm install

- name: Override ESLint
working-directory: apps/compatibility-check
run: pnpm install -D eslint@${{ matrix.eslint }}

- name: Lint project
working-directory: apps/compatibility-check
run: pnpm run lint
3 changes: 2 additions & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ jobs:
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
registry-url: https://registry.npmjs.org/
- run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
# - run: pnpm install --frozen-lockfile
- run: pnpm publish --access public --no-git-checks
working-directory: packages/linting
36 changes: 36 additions & 0 deletions apps/compatibility-check/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
File renamed without changes.
36 changes: 36 additions & 0 deletions apps/compatibility-check/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
8 changes: 8 additions & 0 deletions apps/compatibility-check/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @type {import('eslint').Linter.FlatConfig[]}
*/
module.exports = [
...require('@atmina/linting/eslint/recommended'),
require('@atmina/linting/eslint/tailwind'),
require('@atmina/linting/eslint/next')(require('@next/eslint-plugin-next')),
];
4 changes: 4 additions & 0 deletions apps/compatibility-check/next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default nextConfig;
35 changes: 35 additions & 0 deletions apps/compatibility-check/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "compatibility-check",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "pnpm run lint:fix && pnpm run prettier:fix",
"lint:check": "eslint . --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint . --fix --report-unused-disable-directives --max-warnings 0",
"prettier:check": "prettier . --check",
"prettier:fix": "prettier . --write"
},
"dependencies": {
"next": "14.2.14",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@atmina/linting": "workspace:*",
"@next/eslint-plugin-next": "^14.2.14",
"@types/eslint": "9.6.1",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^9.12.0",
"eslint-config-next": "14.2.14",
"postcss": "^8",
"prettier": "3.3.3",
"tailwindcss": "^3.4.1",
"typescript": "^5"
},
"prettier": "@atmina/linting/prettier"
}
8 changes: 8 additions & 0 deletions apps/compatibility-check/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/** @type {import('postcss-load-config').Config} */
const config = {
plugins: {
tailwindcss: {},
},
};

export default config;
Binary file added apps/compatibility-check/src/app/favicon.ico
Binary file not shown.
Binary file not shown.
Binary file not shown.
27 changes: 27 additions & 0 deletions apps/compatibility-check/src/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
--background: #ffffff;
--foreground: #171717;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;
}
}

body {
color: var(--foreground);
background: var(--background);
font-family: Arial, Helvetica, sans-serif;
}

@layer utilities {
.text-balance {
text-wrap: balance;
}
}
35 changes: 35 additions & 0 deletions apps/compatibility-check/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type {Metadata} from 'next';
import localFont from 'next/font/local';
import './globals.css';

const geistSans = localFont({
src: './fonts/GeistVF.woff',
variable: '--font-geist-sans',
weight: '100 900',
});
const geistMono = localFont({
src: './fonts/GeistMonoVF.woff',
variable: '--font-geist-mono',
weight: '100 900',
});

export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
};

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang='en'>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
</html>
);
}
101 changes: 101 additions & 0 deletions apps/compatibility-check/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import Image from 'next/image';

export default function Home() {
return (
<div className='grid min-h-screen grid-rows-[20px_1fr_20px] items-center justify-items-center gap-16 p-8 pb-20 font-[family-name:var(--font-geist-sans)] sm:p-20'>
<main className='row-start-2 flex flex-col items-center gap-8 sm:items-start'>
<Image
className='dark:invert'
src='https://nextjs.org/icons/next.svg'
alt='Next.js logo'
width={180}
height={38}
priority
/>
<ol className='list-inside list-decimal text-center font-[family-name:var(--font-geist-mono)] text-sm sm:text-left'>
<li className='mb-2'>
Get started by editing{' '}
<code className='rounded bg-black/[.05] px-1 py-0.5 font-semibold dark:bg-white/[.06]'>
src/app/page.tsx
</code>
.
</li>
<li>Save and see your changes instantly.</li>
</ol>

<div className='flex flex-col items-center gap-4 sm:flex-row'>
<a
className='flex h-10 items-center justify-center gap-2 rounded-full border border-solid border-transparent bg-foreground px-4 text-sm text-background transition-colors hover:bg-[#383838] sm:h-12 sm:px-5 sm:text-base dark:hover:bg-[#ccc]'
href='https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app'
target='_blank'
rel='noopener noreferrer'
>
<Image
className='dark:invert'
src='https://nextjs.org/icons/vercel.svg'
alt='Vercel logomark'
width={20}
height={20}
/>
Deploy now
</a>
<a
className='flex h-10 items-center justify-center rounded-full border border-solid border-black/[.08] px-4 text-sm transition-colors hover:border-transparent hover:bg-[#f2f2f2] sm:h-12 sm:min-w-44 sm:px-5 sm:text-base dark:border-white/[.145] dark:hover:bg-[#1a1a1a]'
href='https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app'
target='_blank'
rel='noopener noreferrer'
>
Read our docs
</a>
</div>
</main>
<footer className='row-start-3 flex flex-wrap items-center justify-center gap-6'>
<a
className='flex items-center gap-2 hover:underline hover:underline-offset-4'
href='https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app'
target='_blank'
rel='noopener noreferrer'
>
<Image
aria-hidden
src='https://nextjs.org/icons/file.svg'
alt='File icon'
width={16}
height={16}
/>
Learn
</a>
<a
className='flex items-center gap-2 hover:underline hover:underline-offset-4'
href='https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app'
target='_blank'
rel='noopener noreferrer'
>
<Image
aria-hidden
src='https://nextjs.org/icons/window.svg'
alt='Window icon'
width={16}
height={16}
/>
Examples
</a>
<a
className='flex items-center gap-2 hover:underline hover:underline-offset-4'
href='https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app'
target='_blank'
rel='noopener noreferrer'
>
<Image
aria-hidden
src='https://nextjs.org/icons/globe.svg'
alt='Globe icon'
width={16}
height={16}
/>
Go to nextjs.org →
</a>
</footer>
</div>
);
}
19 changes: 19 additions & 0 deletions apps/compatibility-check/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type {Config} from 'tailwindcss';

const config: Config = {
content: [
'./src/pages/**/*.{js,ts,jsx,tsx,mdx}',
'./src/components/**/*.{js,ts,jsx,tsx,mdx}',
'./src/app/**/*.{js,ts,jsx,tsx,mdx}',
],
theme: {
extend: {
colors: {
background: 'var(--background)',
foreground: 'var(--foreground)',
},
},
},
plugins: [],
};
export default config;
Loading

0 comments on commit 82a92d0

Please sign in to comment.