This monorepo provides the development environment for three packages with extensible ESLint configurations for Javascript, React and Typescript development in (not exclusively) the t3n.de domain.
Note: These packages use ESLint v9's flat config format. Make sure you're using ESLint v9 or later.
Provides the extensible base eslint configuration for javascript projects.
In your project's eslint.config.js, add the following:
import baseConfig from '@t3n/eslint-config';
import { defineConfig } from 'eslint/config';
export default defineConfig([baseConfig]);Use this configuration alongside the base configuration if your project uses React.
In your project's eslint.config.js, add the following:
import baseConfig from '@t3n/eslint-config';
import reactConfig from '@t3n/eslint-config-react';
import { defineConfig } from 'eslint/config';
export default defineConfig([baseConfig, reactConfig]);Use this configuration alongside the base configuration if your project uses Typescript.
In your project's eslint.config.js, add the following:
import baseConfig from '@t3n/eslint-config';
import typescriptConfig from '@t3n/eslint-config-typescript';
import { defineConfig } from 'eslint/config';
export default defineConfig([baseConfig, typescriptConfig]);For projects using both React and TypeScript:
import baseConfig from '@t3n/eslint-config';
import reactConfig from '@t3n/eslint-config-react';
import typescriptConfig from '@t3n/eslint-config-typescript';
import { defineConfig } from 'eslint/config';
export default defineConfig([baseConfig, reactConfig, typescriptConfig]);When using these configurations in ESM projects (projects with "type": "module" in package.json), you may encounter ESLint errors about file extensions in import statements:
error Unexpected use of file extension "js" for "./path/to/file.js" import/extensions
This happens because Node.js ESM requires explicit file extensions (.js, .mjs) for relative imports, but the default import/extensions rule enforces omitting them.
To resolve this in your project's eslint.config.js, override the rule to allow .js extensions:
import baseConfig from '@t3n/eslint-config';
import { defineConfig } from 'eslint/config';
export default defineConfig([
baseConfig,
{
rules: {
'import/extensions': [
'error',
'ignorePackages',
{
js: 'always', // or 'ignorePackages' to allow .js extensions
mjs: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
},
},
]);Alternatively, you can disable the rule entirely for your project:
import baseConfig from '@t3n/eslint-config';
import { defineConfig } from 'eslint/config';
export default defineConfig([
baseConfig,
{
rules: {
'import/extensions': 'off',
},
},
]);Install all necessary development dependencies by running npm install