Skip to content

Commit c9f47b5

Browse files
marsicdevclaude
andcommitted
chore: prepare package for npm publishing and update dependencies
- Add package metadata (author, files, engines) for proper npm publishing - Update GitHub Actions to latest versions (checkout@v4, setup-node@v4) - Use Node.js LTS version in CI workflow - Add legacy.js export for backward compatibility - Update examples with proper documentation - Refine ESLint configurations for better developer experience - Update dependencies to latest compatible versions This ensures the package is ready for public npm distribution with proper metadata, modern CI/CD setup, and comprehensive examples for both ESLint 8.x and 9.x configurations. 🤖 Generated with Claude Code Co-Authored-By: Claude <[email protected]>
1 parent ea2d14f commit c9f47b5

File tree

12 files changed

+1069
-662
lines changed

12 files changed

+1069
-662
lines changed

.github/workflows/npm-publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ jobs:
1212
contents: write
1313
id-token: write
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
- name: Get package version
1717
id: package-version
1818
uses: martinbeentjes/[email protected]
1919
- name: Setup node environment
20-
uses: actions/setup-node@v3
20+
uses: actions/setup-node@v4
2121
with:
22-
node-version: '20.x'
22+
node-version: 'lts/*'
2323
registry-url: https://registry.npmjs.org
2424
- run: npm ci
2525
- name: Publish to NPM

CHANGELOG.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,37 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [3.0.0] - 2025-05-09
5+
## [3.0.0] - 2025-07-24
6+
7+
### Breaking Changes
8+
9+
- **Default export changed**: The package now exports the Next.js 15 flat configuration by default
10+
- **Legacy configuration moved**: ESLint 8.x configuration is now available at `@hypetech/eslint-config/legacy`
11+
- **Minimum ESLint version**: Now requires ESLint 9.x or higher
612

713
### Added
814

9-
- Support for Next.js 15 with ESLint 9 flat configuration system
10-
- New flat config export via `@hypetech/eslint-config/flat`
15+
- Full support for Next.js 15 with ESLint 9 flat configuration system as the default export
16+
- New legacy export path (`/legacy`) for backward compatibility with ESLint 8.x
17+
- New dependency: `@next/eslint-plugin-next` for Next.js 15 specific rules
1118
- Example configurations for both Next.js 14 and Next.js 15
12-
- Comprehensive documentation for both configuration types
19+
- Comprehensive globals definition for browser, Node.js, and React environments
20+
- Improved import ordering with more granular path groups
1321

1422
### Changed
1523

16-
- Updated `ecmaVersion` from 2020 to 2022 in the traditional configuration
17-
- Updated peer dependency for ESLint to require version 9.x or higher
18-
- Added new dependencies: `@eslint/eslintrc` and `@eslint/js` for flat config support
24+
- **Default configuration**: Next.js 15 flat config is now the main export (`index.js`)
25+
- **Import path for flat config**: Still available at `/flat` but now identical to default export
26+
- Updated `ecmaVersion` to `latest` in the flat configuration
27+
- Enhanced TypeScript configuration with project-aware parsing
28+
- Updated all dependencies to their latest versions
29+
- Restructured package exports for better developer experience
30+
31+
### Migration Guide
32+
33+
- For Next.js 15 projects: Use the default import `import eslintConfig from '@hypetech/eslint-config'`
34+
- For legacy projects: Update imports to use `@hypetech/eslint-config/legacy`
35+
- All ESLint plugins are now included as dependencies (no need to install separately)
1936

2037
## [2.1.0] - 2023-07-24
2138

README.md

Lines changed: 103 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,31 @@
22

33
The official HypeTech eslint configuration, part of the Frontend Coding Standards.
44

5-
> **New in v3.0.0**: Support for Next.js 15 with ESLint 9 flat configuration system.
5+
> **New in v3.0.0**: Next.js 15 with ESLint 9 flat configuration is now the default. Legacy ESLint 8.x configuration is still available.
6+
7+
## Quick Start
8+
9+
```bash
10+
# Install
11+
pnpm add -D @hypetech/eslint-config eslint@^9 prettier@^3
12+
13+
# Create eslint.config.mjs
14+
echo "import eslintConfig from '@hypetech/eslint-config';\nexport default eslintConfig;" > eslint.config.mjs
15+
```
616

717
## Configuration Types
818

919
This package provides two types of ESLint configurations:
1020

11-
1. **Traditional Configuration** (for ESLint 8.x and Next.js 14 or earlier)
12-
2. **Flat Configuration** (for ESLint 9.x and Next.js 15 or later)
21+
1. **Flat Configuration** (default) - for ESLint 9.x and Next.js 15 or later
22+
- Import: `import eslintConfig from '@hypetech/eslint-config'`
23+
- Modern flat config system with improved performance
24+
- Includes Next.js 15 specific rules and optimizations
25+
26+
2. **Legacy Configuration** - for ESLint 8.x and Next.js 14 or earlier
27+
- Import: `extends: '@hypetech/eslint-config/legacy'`
28+
- Traditional .eslintrc configuration
29+
- Maintained for backward compatibility
1330

1431
## Installation
1532

@@ -35,104 +52,47 @@ With NPM:
3552
npm install --save-dev @hypetech/eslint-config
3653
```
3754

38-
### Additional Dependencies for Next.js 15 (Flat Config)
55+
### Peer Dependencies
3956

40-
If you're using Next.js 15 with ESLint 9 flat configuration, you'll need these additional dependencies:
57+
This package requires ESLint 9.x or higher and Prettier 3.x or higher:
4158

4259
```bash
43-
pnpm add -D eslint@^9.0.0 @eslint/eslintrc@^3.0.0 @eslint/js@^9.0.0
60+
pnpm add -D eslint@^9.0.0 prettier@^3.0.0
4461
# or
45-
yarn add -D eslint@^9.0.0 @eslint/eslintrc@^3.0.0 @eslint/js@^9.0.0
62+
yarn add -D eslint@^9.0.0 prettier@^3.0.0
4663
# or
47-
npm install --save-dev eslint@^9.0.0 @eslint/eslintrc@^3.0.0 @eslint/js@^9.0.0
48-
```
49-
50-
## Usage
51-
52-
### Traditional Configuration (ESLint 8.x, Next.js 14 or earlier)
53-
54-
To use the traditional configuration, you have several options:
55-
56-
#### Option 1: Via package.json
57-
58-
Add the `eslint` property to your `package.json` file:
59-
60-
```json
61-
"eslintConfig": {
62-
"extends": "@hypetech/eslint-config"
63-
}
64-
```
65-
66-
You can use the `npm pkg` subcommand to add this automatically:
67-
68-
```bash
69-
npm pkg set eslintConfig.extends=@hypetech/eslint-config
64+
npm install --save-dev eslint@^9.0.0 prettier@^3.0.0
7065
```
7166

72-
#### Option 2: Via .eslintrc.js or .eslintrc.cjs
67+
> **Note**: All ESLint plugins and parsers are included as dependencies, so you don't need to install them separately.
7368
74-
Create a `.eslintrc.js` file (or `.eslintrc.cjs` if your package uses `"type": "module"`) in your project root:
75-
76-
```js
77-
module.exports = {
78-
root: true,
79-
extends: '@hypetech/eslint-config',
80-
}
81-
```
82-
83-
#### Option 3: Extending the configuration
84-
85-
To customize the configuration, create a `.eslintrc.js` or `.eslintrc.cjs` file:
86-
87-
```js
88-
module.exports = {
89-
...require('@hypetech/eslint-config'),
90-
rules: {
91-
// Your custom rules here
92-
'no-console': 'warn',
93-
},
94-
}
95-
```
96-
97-
> **Best Practice**: Use `package.json` for libraries and `.eslintrc.js`/`.eslintrc.cjs` for applications. Avoid using both methods in the same project.
69+
## Usage
9870

99-
### Flat Configuration (ESLint 9.x, Next.js 15 or later)
71+
### Flat Configuration (Default - ESLint 9.x, Next.js 15 or later)
10072

101-
Next.js 15 uses ESLint 9 with the new flat configuration system. Here's how to use our flat config:
73+
Next.js 15 uses ESLint 9 with the new flat configuration system. This is now the default export:
10274

10375
#### Option 1: Basic Usage
10476

10577
Create an `eslint.config.mjs` file in your project root:
10678

10779
```js
10880
// eslint.config.mjs
109-
import hypeConfig from '@hypetech/eslint-config/flat';
81+
import eslintConfig from '@hypetech/eslint-config';
11082

111-
export default hypeConfig;
83+
export default eslintConfig;
11284
```
11385

11486
#### Option 2: Extending the Configuration
11587

116-
To customize the configuration, you can extend it in your `eslint.config.mjs` file:
88+
To customize the configuration:
11789

11890
```js
11991
// eslint.config.mjs
120-
import { dirname } from "path";
121-
import { fileURLToPath } from "url";
122-
import { FlatCompat } from "@eslint/eslintrc";
123-
import js from "@eslint/js";
124-
import hypeConfig from '@hypetech/eslint-config/flat';
125-
126-
const __filename = fileURLToPath(import.meta.url);
127-
const __dirname = dirname(__filename);
92+
import eslintConfig from '@hypetech/eslint-config';
12893

129-
const compat = new FlatCompat({
130-
baseDirectory: __dirname,
131-
recommendedConfig: js.configs.recommended,
132-
});
133-
134-
const eslintConfig = [
135-
...hypeConfig,
94+
export default [
95+
...eslintConfig,
13696
// Your custom configurations here
13797
{
13898
files: ["**/*.ts", "**/*.tsx"],
@@ -142,8 +102,6 @@ const eslintConfig = [
142102
},
143103
},
144104
];
145-
146-
export default eslintConfig;
147105
```
148106

149107
#### Option 3: Adding Additional Plugins
@@ -152,22 +110,20 @@ To add additional plugins to the configuration:
152110

153111
```js
154112
// eslint.config.mjs
113+
import { FlatCompat } from "@eslint/eslintrc";
114+
import eslintConfig from '@hypetech/eslint-config';
155115
import { dirname } from "path";
156116
import { fileURLToPath } from "url";
157-
import { FlatCompat } from "@eslint/eslintrc";
158-
import js from "@eslint/js";
159-
import hypeConfig from '@hypetech/eslint-config/flat';
160117

161118
const __filename = fileURLToPath(import.meta.url);
162119
const __dirname = dirname(__filename);
163120

164121
const compat = new FlatCompat({
165122
baseDirectory: __dirname,
166-
recommendedConfig: js.configs.recommended,
167123
});
168124

169-
const eslintConfig = [
170-
...hypeConfig,
125+
export default [
126+
...eslintConfig,
171127
// Add additional plugins using FlatCompat
172128
...compat.extends("plugin:tailwindcss/recommended"),
173129
// Your custom rules
@@ -178,29 +134,75 @@ const eslintConfig = [
178134
},
179135
},
180136
];
137+
```
181138
182-
export default eslintConfig;
139+
### Legacy Configuration (ESLint 8.x, Next.js 14 or earlier)
140+
141+
To use the legacy configuration, import it from the `/legacy` path:
142+
143+
#### Option 1: Via package.json
144+
145+
Add the `eslint` property to your `package.json` file:
146+
147+
```json
148+
"eslintConfig": {
149+
"extends": "@hypetech/eslint-config/legacy"
150+
}
151+
```
152+
153+
You can use the `npm pkg` subcommand to add this automatically:
154+
155+
```bash
156+
npm pkg set eslintConfig.extends=@hypetech/eslint-config/legacy
183157
```
184158
159+
#### Option 2: Via .eslintrc.js or .eslintrc.cjs
160+
161+
Create a `.eslintrc.js` file (or `.eslintrc.cjs` if your package uses `"type": "module"`) in your project root:
162+
163+
```js
164+
module.exports = {
165+
root: true,
166+
extends: '@hypetech/eslint-config/legacy',
167+
}
168+
```
169+
170+
#### Option 3: Extending the configuration
171+
172+
To customize the configuration, create a `.eslintrc.js` or `.eslintrc.cjs` file:
173+
174+
```js
175+
module.exports = {
176+
...require('@hypetech/eslint-config/legacy'),
177+
rules: {
178+
// Your custom rules here
179+
'no-console': 'warn',
180+
},
181+
}
182+
```
183+
184+
> **Best Practice**: Use `package.json` for libraries and `.eslintrc.js`/`.eslintrc.cjs` for applications. Avoid using both methods in the same project.
185+
185186
## Migration Guide
186187
187188
### Migrating from ESLint 8 to ESLint 9 (Next.js 14 to Next.js 15)
188189
189-
1. **Install required dependencies**:
190+
1. **Update dependencies**:
190191
```bash
191-
npm install --save-dev eslint@^9.0.0 @eslint/eslintrc@^3.0.0 @eslint/js@^9.0.0
192+
npm install --save-dev eslint@^9.0.0 prettier@^3.0.0
193+
npm update @hypetech/eslint-config
192194
```
193195
194196
2. **Create a new flat config file**:
195197
Create an `eslint.config.mjs` file in your project root:
196198
```js
197-
import hypeConfig from '@hypetech/eslint-config/flat';
199+
import eslintConfig from '@hypetech/eslint-config';
198200

199-
export default hypeConfig;
201+
export default eslintConfig;
200202
```
201203
202204
3. **Remove old configuration**:
203-
If you have an existing `.eslintrc.js`, `.eslintrc.cjs`, or `eslintConfig` in your `package.json`, you can remove it or keep it for backward compatibility with tools that don't yet support the flat config system.
205+
If you have an existing `.eslintrc.js`, `.eslintrc.cjs`, or `eslintConfig` in your `package.json`, you can remove it.
204206
205207
4. **Update your VS Code settings** (optional):
206208
If you're using VS Code, update your settings to work with the new flat config:
@@ -210,6 +212,18 @@ export default eslintConfig;
210212
}
211213
```
212214
215+
### Using Legacy Configuration
216+
217+
If you need to continue using the ESLint 8.x configuration (e.g., for compatibility reasons), update your imports:
218+
219+
```js
220+
// Before (v2.x)
221+
extends: '@hypetech/eslint-config'
222+
223+
// After (v3.x)
224+
extends: '@hypetech/eslint-config/legacy'
225+
```
226+
213227
# Contributing
214228
215229
Contributions are welcome! Open a pull request to fix a bug, or open an issue to discuss a new feature or change.

eslint.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const compat = new FlatCompat({
1111
recommendedConfig: js.configs.recommended,
1212
});
1313

14-
// Import the existing configuration
15-
const existingConfig = require("./index.js");
14+
// Import the legacy configuration
15+
const existingConfig = require("./legacy.js");
1616

1717
const eslintConfig = [
1818
...compat.config({

examples/nextjs14-example/.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// Example .eslintrc.js for a Next.js 14 project
1+
// Example .eslintrc.js for a Next.js 14 project using ESLint 8.x
22
module.exports = {
33
root: true,
4-
extends: '@hypetech/eslint-config',
4+
extends: '@hypetech/eslint-config/legacy',
55
rules: {
66
// Add any project-specific rules here
77
'no-console': 'warn',

0 commit comments

Comments
 (0)