Skip to main content
Version: v2

Migration Guide

Starting from version 2, this package has been modularized into the following independent components, enabling developers to apply rules specific to their framework and whether their project uses TypeScript:

The core package, @stylistic/eslint-plugin which this package relies on, has been further split into the following specialized packages:

Node.js​

If you are using typescript in your project, add the ts module from this package, the rest of the config file remains the same.

import jsConfig from '@nish1896/eslint-flat-config/js';
+ import tsConfig from '@nish1896/eslint-flat-config/ts';

export default [
...jsConfig,
+ ...tsConfig,
{
rules: {}
}
];

React & Vite​

Add the ts module from this package, if your application uses typescript.

import jsConfig from '@nish1896/eslint-flat-config/js';
+ import tsConfig from '@nish1896/eslint-flat-config/ts';
import jsxConfig from '@nish1896/eslint-flat-config/jsx';

export default [
...jsConfig,
+ ...tsConfig,
...jsxConfig,
];

Next.js​

In version 2, the next module now exclusively includes JSX-specific rules to be used alongside the eslint-plugin-next. To apply JavaScript and TypeScript rules, you must import them separately from the js and next-ts modules of this package.

Javascript

import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';
+ import jsConfig from '@nish1896/eslint-flat-config/js';
import nextConfig from '@nish1896/eslint-flat-config/next';

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

const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [
+ ...jsConfig,
...nextConfig,
...compat.extends('next/core-web-vitals'),
{
rules: {
}
}
];

export default eslintConfig;

With Typescript

The next-ts module contains the typescript specific rules for Next.js application.

import { dirname } from 'path';
import { fileURLToPath } from 'url';
import { FlatCompat } from '@eslint/eslintrc';
+ import jsConfig from '@nish1896/eslint-flat-config/js';
import nextConfig from '@nish1896/eslint-flat-config/next';
+ import nextTsConfig from '@nish1896/eslint-flat-config/next-ts';

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

const compat = new FlatCompat({
baseDirectory: __dirname,
});

const eslintConfig = [
+ ...jsConfig,
...nextConfig,
+ ...nextTsConfig,
...compat.extends('next/core-web-vitals', 'next/typescript'),
{
rules: {
}
}
];

export default eslintConfig;