The official HypeTech eslint configuration, part of the Frontend Coding Standards.
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.
# Install
pnpm add -D @hypetech/eslint-config eslint@^9 prettier@^3
# Create eslint.config.mjs
echo "import eslintConfig from '@hypetech/eslint-config';\nexport default eslintConfig;" > eslint.config.mjs
This package provides two types of ESLint configurations:
-
Flat Configuration (default) - for ESLint 9.x and Next.js 15 or later
- Import:
import eslintConfig from '@hypetech/eslint-config'
- Modern flat config system with improved performance
- Includes Next.js 15 specific rules and optimizations
- Import:
-
Legacy Configuration - for ESLint 8.x and Next.js 14 or earlier
- Import:
extends: '@hypetech/eslint-config/legacy'
- Traditional .eslintrc configuration
- Maintained for backward compatibility
- Import:
The configuration can be installed via your preferred package manager.
With PNPM (preferred):
pnpm add @hypetech/eslint-config -D
With Yarn:
yarn add -D @hypetech/eslint-config
With NPM:
npm install --save-dev @hypetech/eslint-config
This package requires ESLint 9.x or higher and Prettier 3.x or higher:
pnpm add -D eslint@^9.0.0 prettier@^3.0.0
# or
yarn add -D eslint@^9.0.0 prettier@^3.0.0
# or
npm install --save-dev eslint@^9.0.0 prettier@^3.0.0
Note: All ESLint plugins and parsers are included as dependencies, so you don't need to install them separately.
Next.js 15 uses ESLint 9 with the new flat configuration system. This is now the default export:
Create an eslint.config.mjs
file in your project root:
// eslint.config.mjs
import eslintConfig from '@hypetech/eslint-config';
export default eslintConfig;
To customize the configuration:
// eslint.config.mjs
import eslintConfig from '@hypetech/eslint-config';
export default [
...eslintConfig,
// Your custom configurations here
{
files: ["**/*.ts", "**/*.tsx"],
rules: {
// Your custom rules here
"no-console": "warn",
},
},
];
To add additional plugins to the configuration:
// eslint.config.mjs
import { FlatCompat } from "@eslint/eslintrc";
import eslintConfig from '@hypetech/eslint-config';
import { dirname } from "path";
import { fileURLToPath } from "url";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
});
export default [
...eslintConfig,
// Add additional plugins using FlatCompat
...compat.extends("plugin:tailwindcss/recommended"),
// Your custom rules
{
files: ["**/*.ts", "**/*.tsx"],
rules: {
"no-console": "warn",
},
},
];
To use the legacy configuration, import it from the /legacy
path:
Add the eslint
property to your package.json
file:
"eslintConfig": {
"extends": "@hypetech/eslint-config/legacy"
}
You can use the npm pkg
subcommand to add this automatically:
npm pkg set eslintConfig.extends=@hypetech/eslint-config/legacy
Create a .eslintrc.js
file (or .eslintrc.cjs
if your package uses "type": "module"
) in your project root:
module.exports = {
root: true,
extends: '@hypetech/eslint-config/legacy',
}
To customize the configuration, create a .eslintrc.js
or .eslintrc.cjs
file:
module.exports = {
...require('@hypetech/eslint-config/legacy'),
rules: {
// Your custom rules here
'no-console': 'warn',
},
}
Best Practice: Use
package.json
for libraries and.eslintrc.js
/.eslintrc.cjs
for applications. Avoid using both methods in the same project.
-
Update dependencies:
npm install --save-dev eslint@^9.0.0 prettier@^3.0.0 npm update @hypetech/eslint-config
-
Create a new flat config file: Create an
eslint.config.mjs
file in your project root:import eslintConfig from '@hypetech/eslint-config'; export default eslintConfig;
-
Remove old configuration: If you have an existing
.eslintrc.js
,.eslintrc.cjs
, oreslintConfig
in yourpackage.json
, you can remove it. -
Update your VS Code settings (optional): If you're using VS Code, update your settings to work with the new flat config:
{ "eslint.experimental.useFlatConfig": true }
If you need to continue using the ESLint 8.x configuration (e.g., for compatibility reasons), update your imports:
// Before (v2.x)
extends: '@hypetech/eslint-config'
// After (v3.x)
extends: '@hypetech/eslint-config/legacy'
Contributions are welcome! Open a pull request to fix a bug, or open an issue to discuss a new feature or change.
This project is licensed under the terms of the MIT license.